-
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.
-
Re: Unix SQR read file
[QUOTE=joax_27;24548]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.[/QUOTE]
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