SlideShare a Scribd company logo
1 of 2
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
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

More Related Content

Viewers also liked

Viewers also liked (13)

Data file handling in c++
Data file handling in c++Data file handling in c++
Data file handling in c++
 
Elegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and ExceptionsElegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and Exceptions
 
File handling
File handlingFile handling
File handling
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
Exception handling
Exception handlingException handling
Exception handling
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Shapeless- Generic programming for Scala
Shapeless- Generic programming for ScalaShapeless- Generic programming for Scala
Shapeless- Generic programming for Scala
 
basics of file handling
basics of file handlingbasics of file handling
basics of file handling
 
File Handling In C++
File Handling In C++File Handling In C++
File Handling In C++
 
File Handling in C++
File Handling in C++File Handling in C++
File Handling in C++
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
 
file handling c++
file handling c++file handling c++
file handling c++
 

More from aminem_mp

as400 built in function- %YEARS
as400 built in function- %YEARSas400 built in function- %YEARS
as400 built in function- %YEARSaminem_mp
 
as400 built in function- %TIMESTAMP
as400 built in function- %TIMESTAMPas400 built in function- %TIMESTAMP
as400 built in function- %TIMESTAMPaminem_mp
 
as400 built in function- %STATUS
as400 built in function- %STATUSas400 built in function- %STATUS
as400 built in function- %STATUSaminem_mp
 
as400 built in function- %SIZE
as400 built in function- %SIZEas400 built in function- %SIZE
as400 built in function- %SIZEaminem_mp
 
as400 built in function- %SECONDS
as400 built in function- %SECONDSas400 built in function- %SECONDS
as400 built in function- %SECONDSaminem_mp
 
as400 built in function- %SCAN
as400 built in function- %SCANas400 built in function- %SCAN
as400 built in function- %SCANaminem_mp
 
as400 built in function- %REPLACE
as400 built in function- %REPLACEas400 built in function- %REPLACE
as400 built in function- %REPLACEaminem_mp
 
as400 built in function- %PARMS
as400 built in function- %PARMSas400 built in function- %PARMS
as400 built in function- %PARMSaminem_mp
 
as400 built in function- %OPEN
as400 built in function- %OPENas400 built in function- %OPEN
as400 built in function- %OPENaminem_mp
 
as400 built in function- %MONTHS
as400 built in function- %MONTHSas400 built in function- %MONTHS
as400 built in function- %MONTHSaminem_mp
 
as400 built in function- %MINUTES
as400 built in function- %MINUTESas400 built in function- %MINUTES
as400 built in function- %MINUTESaminem_mp
 
as400 built in function- %INTH
as400 built in function- %INTHas400 built in function- %INTH
as400 built in function- %INTHaminem_mp
 
as400 built in function-list
as400 built in function-listas400 built in function-list
as400 built in function-listaminem_mp
 
as400 built in function- %ELEM
as400 built in function- %ELEMas400 built in function- %ELEM
as400 built in function- %ELEMaminem_mp
 
as400 built in function- %DIFF
as400 built in function- %DIFFas400 built in function- %DIFF
as400 built in function- %DIFFaminem_mp
 
as400 built in function- %DAYS
as400 built in function- %DAYSas400 built in function- %DAYS
as400 built in function- %DAYSaminem_mp
 
as400 built in function- %CHAR
as400 built in function- %CHARas400 built in function- %CHAR
as400 built in function- %CHARaminem_mp
 
as400 built in function- %ABS
as400 built in function- %ABSas400 built in function- %ABS
as400 built in function- %ABSaminem_mp
 
as400 built in function- %HOURS
as400 built in function- %HOURSas400 built in function- %HOURS
as400 built in function- %HOURSaminem_mp
 
as400 built in function- %MSSECONDS
as400 built in function- %MSSECONDSas400 built in function- %MSSECONDS
as400 built in function- %MSSECONDSaminem_mp
 

More from aminem_mp (20)

as400 built in function- %YEARS
as400 built in function- %YEARSas400 built in function- %YEARS
as400 built in function- %YEARS
 
as400 built in function- %TIMESTAMP
as400 built in function- %TIMESTAMPas400 built in function- %TIMESTAMP
as400 built in function- %TIMESTAMP
 
as400 built in function- %STATUS
as400 built in function- %STATUSas400 built in function- %STATUS
as400 built in function- %STATUS
 
as400 built in function- %SIZE
as400 built in function- %SIZEas400 built in function- %SIZE
as400 built in function- %SIZE
 
as400 built in function- %SECONDS
as400 built in function- %SECONDSas400 built in function- %SECONDS
as400 built in function- %SECONDS
 
as400 built in function- %SCAN
as400 built in function- %SCANas400 built in function- %SCAN
as400 built in function- %SCAN
 
as400 built in function- %REPLACE
as400 built in function- %REPLACEas400 built in function- %REPLACE
as400 built in function- %REPLACE
 
as400 built in function- %PARMS
as400 built in function- %PARMSas400 built in function- %PARMS
as400 built in function- %PARMS
 
as400 built in function- %OPEN
as400 built in function- %OPENas400 built in function- %OPEN
as400 built in function- %OPEN
 
as400 built in function- %MONTHS
as400 built in function- %MONTHSas400 built in function- %MONTHS
as400 built in function- %MONTHS
 
as400 built in function- %MINUTES
as400 built in function- %MINUTESas400 built in function- %MINUTES
as400 built in function- %MINUTES
 
as400 built in function- %INTH
as400 built in function- %INTHas400 built in function- %INTH
as400 built in function- %INTH
 
as400 built in function-list
as400 built in function-listas400 built in function-list
as400 built in function-list
 
as400 built in function- %ELEM
as400 built in function- %ELEMas400 built in function- %ELEM
as400 built in function- %ELEM
 
as400 built in function- %DIFF
as400 built in function- %DIFFas400 built in function- %DIFF
as400 built in function- %DIFF
 
as400 built in function- %DAYS
as400 built in function- %DAYSas400 built in function- %DAYS
as400 built in function- %DAYS
 
as400 built in function- %CHAR
as400 built in function- %CHARas400 built in function- %CHAR
as400 built in function- %CHAR
 
as400 built in function- %ABS
as400 built in function- %ABSas400 built in function- %ABS
as400 built in function- %ABS
 
as400 built in function- %HOURS
as400 built in function- %HOURSas400 built in function- %HOURS
as400 built in function- %HOURS
 
as400 built in function- %MSSECONDS
as400 built in function- %MSSECONDSas400 built in function- %MSSECONDS
as400 built in function- %MSSECONDS
 

Recently uploaded

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 

Recently uploaded (20)

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
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