Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Find end of file using 88 level with out using IF

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sureshbait
Warnings : 1

New User


Joined: 02 Feb 2007
Posts: 5
Location: Chennai

PostPosted: Thu Oct 25, 2007 1:20 pm    Post subject: Find end of file using 88 level with out using IF
Reply with quote

Hi
i want to find end of file using 88 level

with out using IF and File status

is it possible?
Back to top
View user's profile Send private message

bshkris

New User


Joined: 21 Mar 2005
Posts: 29
Location: pune

PostPosted: Thu Oct 25, 2007 1:33 pm    Post subject:
Reply with quote

you can use evaluate true condition for this case.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Thu Oct 25, 2007 2:36 pm    Post subject:
Reply with quote

Code:
01  WS-FILE-XXX       PIC X  VALUE 'N'.
    88  WS-FILE-XXX-END      VALUE 'Y'.
    88  WS-FILE-XXX-OK       VALUE 'N'.


READ FILE-XXX
    AT END SET WS-FILE-XXX-END TO TRUE
END-READ


PERFORM UNTIL WS-FILE-XXX-END
    . . .
END-PERFORM

These pieces of code will allow you to sequentially read a file until the end without using a single IF
Back to top
View user's profile Send private message
gorgatz

New User


Joined: 15 Oct 2007
Posts: 2
Location: manila, philippines

PostPosted: Tue Oct 30, 2007 10:57 am    Post subject:
Reply with quote

im sorry for my first post. i thought users are allowed to edit their posts. moderators pls kindly delete it for me. thanks.

I just want to add something to Marso's code. Before doing the the first read, u should set WS-FILE-XXX-OK to TRUE. Listed below is the revised code.

Code:
01 WS-FILE-XXX PIC X VALUE 'N'.
    88 WS-FILE-XXX-END VALUE 'Y'.
    88 WS-FILE-XXX-OK VALUE 'N'.

1000-MAIN-RTN.

    SET WS-FILE-XXX-OK TO TRUE

    PERFORM 2000-READ-RTN
          THRU 2000-READ-RTN-EXIT UNTIL WS-FILE-XXX-END.

1000-MAIN-RTN-EXIT.
    STOP-RUN.
    EJECT


2000-READ-RTN.

    READ FILE-XXX
        AT END SET WS-FILE-XXX-END TO TRUE
    END-READ

2000-READ-RTN-EXIT.
    EXIT.
    EJECT
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Tue Oct 30, 2007 11:01 am    Post subject:
Reply with quote

gorgatz,
I agree that Before doing the the first read, u should set WS-FILE-XXX-OK to TRUE, however marso has done it by using Value clause in working storage declaration. So no need of setting the variable once again.
Back to top
View user's profile Send private message
gorgatz

New User


Joined: 15 Oct 2007
Posts: 2
Location: manila, philippines

PostPosted: Tue Oct 30, 2007 11:05 am    Post subject:
Reply with quote

agkshirsagar wrote:
gorgatz,
I agree that Before doing the the first read, u should set WS-FILE-XXX-OK to TRUE, however marso has done it by using Value clause in working storage declaration. So no need of setting the variable once again.


im sorry i overlooked that part. you're right agkshirsagar no need to set the variable again.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Thu Nov 01, 2007 3:27 pm    Post subject:
Reply with quote

I didn't plan to write the whole program (I usualy avoid questions that start with "write a program for me...")
If I can, I just give a lead but you must continue from there, that's the best way to learn...
Back to top
View user's profile Send private message
sai mainframes

New User


Joined: 02 Nov 2007
Posts: 8
Location: hyderabad

PostPosted: Fri Nov 02, 2007 3:50 pm    Post subject:
Reply with quote

hi all,

SET WS-FILE-XXX-OK TO TRUE .

no need of this if you are accessing this file at one time ( open, read, close)

but if you are going to read the file multiple number of times (i mean to say if it is in loop (all open, read, close operations)....u need to set this...........to true......

any wrong this....

please correct me.......
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Sun Nov 04, 2007 9:16 pm    Post subject:
Reply with quote

In fact, there is a bigger problem: in gorgatz example everything is OK as long as there is no processing done on the record.
If I add some processing (done in PERFORM 3000-) it gives:
Code:
1000-MAIN-RTN.
    SET WS-FILE-XXX-OK TO TRUE
    PERFORM 2000-READ-RTN
          THRU 2000-READ-RTN-EXIT UNTIL WS-FILE-XXX-END.
1000-MAIN-RTN-EXIT.
    STOP-RUN.
    EJECT

2000-READ-RTN.
    READ FILE-XXX
        AT END SET WS-FILE-XXX-END TO TRUE
    END-READ
    PERFORM 3000-PROCESS-RECORD-FROM-FILE
2000-READ-RTN-EXIT.
    EXIT.
    EJECT

or it could be:
Code:
1000-MAIN-RTN.
    SET WS-FILE-XXX-OK TO TRUE
    PERFORM UNTIL WS-FILE-XXX-END
        PERFORM 2000-READ-RTN THRU 2000-READ-RTN-EXIT
        PERFORM 3000-PROCESS-RECORD-FROM-FILE
    END-PERFORM
1000-MAIN-RTN-EXIT.
    STOP-RUN.
    EJECT

2000-READ-RTN.
    READ FILE-XXX
        AT END SET WS-FILE-XXX-END TO TRUE
    END-READ
2000-READ-RTN-EXIT.
    EXIT.
    EJECT

But then I can already hear everybody shouting "HO! HE! AYE!"
Yes, 3000-PROCESS will also be executed after the EOF is raised...
To stay with the original request (no IFs) we can use:
Code:
1000-MAIN-RTN.
    SET WS-FILE-XXX-OK TO TRUE
    PERFORM 2000-READ-RTN
          THRU 2000-READ-RTN-EXIT UNTIL WS-FILE-XXX-END.
1000-MAIN-RTN-EXIT.
    STOP-RUN.
    EJECT

2000-READ-RTN.
    READ FILE-XXX
        AT END SET WS-FILE-XXX-END TO TRUE
        NOT AT END PERFORM 3000-PROCESS-RECORD-FROM-FILE
    END-READ
2000-READ-RTN-EXIT.
    EXIT.
    EJECT

or in the second case:
Code:
1000-MAIN-RTN.
    PERFORM 2000-READ-RTN THRU 2000-READ-RTN-EXIT
    PERFORM UNTIL WS-FILE-XXX-END
        PERFORM 3000-PROCESS-RECORD-FROM-FILE
        PERFORM 2000-READ-RTN THRU 2000-READ-RTN-EXIT
    END-PERFORM
1000-MAIN-RTN-EXIT.
    STOP-RUN.
    EJECT

2000-READ-RTN.
    READ FILE-XXX
        AT END SET WS-FILE-XXX-END TO TRUE
    END-READ
2000-READ-RTN-EXIT.
    EXIT.
    EJECT
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us