Can i read output file created after SORTing in the same pgm



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Can i read output file created after SORTing in the same pgm

Postby savitha_y » Sat Feb 06, 2021 1:17 am

Can i read output file created after SORTing in the same program.

SORT WORK-FILE ON ASCENDING KEY SORT-KEY USING INPUT-FILE GIVING OUTPUT-FILE.
Is there any way, I can read sorted out OUTPUT-FILE in the same program after creating it.

Thank you.
savitha_y
 
Posts: 18
Joined: Mon May 11, 2009 3:05 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can i read output file created after SORTing in the same

Postby chaat » Tue Feb 09, 2021 11:08 am

Have you tried to open the file as input after the sort ?
chaat
 
Posts: 27
Joined: Sun Aug 16, 2009 11:07 pm
Location: St. Cloud, Minnesota
Has thanked: 0 time
Been thanked: 1 time

Re: Can i read output file created after SORTing in the same

Postby willy jensen » Tue Feb 09, 2021 2:35 pm

With DFSORT your SORTOUT can be the dataset as SORTIN, so yes.
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Can i read output file created after SORTing in the same

Postby sergeyken » Tue Feb 09, 2021 7:03 pm

savitha_y wrote:Can i read output file created after SORTing in the same program.

SORT WORK-FILE ON ASCENDING KEY SORT-KEY USING INPUT-FILE GIVING OUTPUT-FILE.
Is there any way, I can read sorted out OUTPUT-FILE in the same program after creating it.

Thank you.

There is nothing special for SORT, or any other program.

Any output DATASET(!) can be opened for input in the same, or any other program, in the same, or any other job step, in the same, or any other job, provided the output dataset has been properly CLOSED after its creation.

That’s it. These are basics of zOS/MVS/...
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 436
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Can i read output file created after SORTing in the same

Postby savitha_y » Tue Feb 09, 2021 7:11 pm

Thank you all for your response. I tried it and it is working fine.
savitha_y
 
Posts: 18
Joined: Mon May 11, 2009 3:05 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post