IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to read the file for multiple times


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
changeurlife2003
Currently Banned

New User


Joined: 22 May 2006
Posts: 15

PostPosted: Mon Oct 09, 2006 4:09 pm
Reply with quote

H,

I have one variable file.

First i have to read the file until end of the file.
Move few fields from each record in to the working storage record fields.
then i have to write it in to the out put file.

Second time i have to read the file from starting it self again
i have to do the same process.

i have coded like this

PERFORM 2000-Frist-READ-PARA THRU 2000-EXIT
UNTIL WS-EOF-FILE = 'Y'.
PERFORM 2010-first-Write-Para THRU 2010-EXIT.
MOVE 'N' TO WS-EOF-FILE.
PERFORM 3000-Second-READ-para THRU 3000-EXIT
UNTIL WS-EOF-FILE = 'Y'.
PERFORM 3010-second-Write-Para THRU 3010-EXIT.
PERFORM 5000-CLOSE-file-PARA THRU 5000-EXIT.

Once i have run this program job is executing but this is abended with
S322(Time Abend)

...............WHY?
Back to top
View user's profile Send private message
Hemant B.

New User


Joined: 05 Oct 2006
Posts: 8

PostPosted: Mon Oct 09, 2006 4:35 pm
Reply with quote

i think in the reading para u not moving 'y' to WS-EOF-FILE.
so it is going into continue loop....

if u wann read a file multiple times........
then.

PERFORM 2000-Frist-READ-PARA THRU 2000-EXIT
UNTIL WS-EOF-FILE = 'Y'.

and in that read para do
PERFORM 2010-first-Write-Para THRU 2010-EXIT

again same for another

MOVE 'N' TO WS-EOF-FILE.
PERFORM 3000-Second-READ-para THRU 3000-EXIT
UNTIL WS-EOF-FILE = 'Y'.
and in that read para do
PERFORM 3010-second-Write-Para THRU 3010-EXIT

if i am wrong let me know it.
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Mon Oct 09, 2006 5:26 pm
Reply with quote

Hi,

File may contain large number of records. To process this twice, will take long time. This may brings the problem.

Why dont you try with time parameter in JCL.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Oct 09, 2006 8:36 pm
Reply with quote

changeurlife2003,

After you read your file the first time to EOF you must close and re-open the file to set the current record pointer back to the first record.

The reason you are getting a time abend is that you re-set the WS_EOF_FILE to 'N' without resetting the Current_record_pointer. Every time you try to read the file again you are getting an error code, not EOF.

Try Closing/re_Opening the file. I think this should help the problem.

Dave
Back to top
View user's profile Send private message
mkodees

New User


Joined: 12 Oct 2006
Posts: 1

PostPosted: Thu Oct 12, 2006 7:38 pm
Reply with quote

Hi,

Instead of closing & opening the files once again. Store the needed values in a working storage in the first read itself. Code separate paragraphs for the processing of the working storage variables.


Thanks
Kodees
Back to top
View user's profile Send private message
bonniem

New User


Joined: 09 Aug 2005
Posts: 67

PostPosted: Mon Oct 16, 2006 9:45 am
Reply with quote

If you are doing the simliar processing then why read the file twice? Read the file, move the fields to working storage, then call separate paragraphs to do both the process
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top