Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 9405

COBOL Programming :: RE: how to DYNAMICALLY write sort cond to o/p file using cobol

$
0
0
Author: sergeyken
Posted: Sun Aug 28, 2016 8:10 am (GMT 5.5)

I guess it makes no sense to convert this to neither COBOL nor anything else.

Since you have your selection list in the file, and finally you need to use SORT facility based on this selection, the better way is to do it straightforward:
Code:

//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SELECT DD *
ADAM
BASU
DAVE
JOHN
MARY
NICK
RAJA
SARA
//INPUT DD DSN=input file
//SORTOUT DD DSN=output file
//SYSIN DD *
 JOINKEYS F1=SELECT,
          FIELDS=(1,4,A)
 JOINKEYS F2=INPUT,
          FIELDS=(1,4,A)
 REFORMAT FIELDS=(F2:1,length)
 SORT FIELDS=(1,4,CH,A)
 SUM FIELDS=NONE
 END
//*

_________________
Tyrannosaurus-REXX


Viewing all articles
Browse latest Browse all 9405

Trending Articles