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

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 

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