Results 1 to 2 of 2

Thread: Unix SQR read file

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Answers
    1

    Unix SQR read file

    Can anyone help me to read file in Unix using SQR.

    I have write a pseducode for this:

    Begin-Procedure Read-File

    LET $file_name ='/data/logs/' || $file_name

    Let #file_status = exists($file_name)

    If #file_status<>0
    STOP QUIET
    End-If


    Open $file_name as 1
    For-Reading
    Record=100:Vary
    STATUS=#Read-Status
    If #Read-Status=-1
    STOP QUIET
    End-If

    Let #flag = 0

    While 1=1
    Read 1 into $myString:100
    If #end-File = 1
    Break
    End-If

    LET $myString = uppercase $myString

    If $myString Like '%SEVERE ERROR%'
    Let #flag=1
    End-If

    End-While

    Close 1

    End-Procedure Read-File


    I am quite skeptical on this one, coz Windows and Unix uses a different file system.


  2. #2
    Junior Member
    Join Date
    Oct 2006
    Answers
    2

    Re: Unix SQR read file

    Quote Originally Posted by joax_27 View Post
    Can anyone help me to read file in Unix using SQR.

    I have write a pseducode for this:

    Begin-Procedure Read-File

    LET $file_name ='/data/logs/' || $file_name

    Let #file_status = exists($file_name)

    If #file_status<>0
    STOP QUIET
    End-If


    Open $file_name as 1
    For-Reading
    Record=100:Vary
    STATUS=#Read-Status
    If #Read-Status=-1
    STOP QUIET
    End-If

    Let #flag = 0

    While 1=1
    Read 1 into $myString:100
    If #end-File = 1
    Break
    End-If

    LET $myString = uppercase $myString

    If $myString Like '%SEVERE ERROR%'
    Let #flag=1
    End-If

    End-While

    Close 1

    End-Procedure Read-File


    I am quite skeptical on this one, coz Windows and Unix uses a different file system.
    hi,
    please look at this code.You need to open an input file by passing parameters separately.

    BEGIN-PROCEDURE open_input_file
    LET #oif_stream = 1

    OPEN $gp_file_name_in AS #oif_stream FOR-READING RECORD=800
    STATUS=#oif_status

    IF #oif_status <> 0
    DISPLAY 'Error opening file.'
    END-IF
    END-PROCEDURE


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact