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
savitha_y
Posts: 18
Joined: Mon May 11, 2009 3:05 pm
Skillset: jcl,cobol,cics,db2
Referer: google

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.

chaat
Posts: 27
Joined: Sun Aug 16, 2009 11:07 pm
Skillset: cobol, db2, application performance tuning
Referer: SEARCH
Location: St. Cloud, Minnesota

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 ?

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

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.

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

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.

savitha_y
Posts: 18
Joined: Mon May 11, 2009 3:05 pm
Skillset: jcl,cobol,cics,db2
Referer: google

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.


  • Similar Topics
    Replies
    Views
    Last post