Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
as400 built in function- %EOF
1. Find many more at website: www.go4as400.com
A programming guide to learn AS400
%EOF (filename)
This built-in function is used to detect end-of file, beginning of file, or subfile full conditions while
performing a file operation similar to resulting indicator.
So, instead of checking any resulting indicator we simply use %EOF to check if the end of file is reached.
%EOF returns '1' if end-of file, beginning of file, or subfile full condition is found ; otherwise, it returns '0'.
READ, READC and READE return %EOF=*ON if the end of file is reached.
READP and READPE return %EOF=*ON if the beginning of file is reached.
WRITE operation returns %EOF=*ON if the WRITE operation to a subfile detail record returned a subfilefull condition.
If %EOF=*ON and we perform CHAIN operation, then CHAIN operation on successful search sets
%EOF=*OFF.
OPEN, SETGT, SETLL on successful operations, sets %EOF=*OFF.
Example- I
Checking EOF status of a file
0127.00
0128.00
0129.00
0130.00
0131.00
0132.00
0133.00
0134.00
0135.00
0136.00
0137.00
0138.00
0139.00
0140.00
0141.00
0142.00
0143.00
0144.00
0145.00
C*_______________FILL SUBFILE__________________
C*_________________________________________________
C*
C
FILSFL1
BEGSR
C
EVAL
RRN=1
C
SETOFF
45
C
DOU
%EOF(MASTER) //The loop is executed until end of
C
READ(N)
REC1
fileis reached
C
IF
%EOF(MASTER)//If end of file is reached then turn
C
EVAL
*IN45=%EOF(MASTER)
onthe bottom indicator
C
LEAVESR
C
ENDIF
C
EVAL
S_ORG=%CHAR(ORG)
C
EVAL
S_ACC=ACC
C
EVAL
S_CCY=CCY
C
WRITE
EXPD_SFL
C
ADD
2
RRN
C
EVAL
LSTRRN=RRN
C
ENDDO
2. 0146.00 C
ENDSR
Example- II
Checking successful CHAIN operation to set %EOF=*OFF
Find many more at website: www.go4as400.com
A programming guide to learn AS400