how to write sort condition to output file using cobol

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
mohamedmubee
Member
Posts: 1
Joined: Fri Aug 26, 2016 3:56 pm

how to write sort condition to output file using cobol

Post by mohamedmubee » Fri Aug 26, 2016 4:59 pm

Hi Everyone,

I am new to this forum, so if there is any mistake teach me...

I would like to know how can we able to write a cobol program or logic to read a record from input file and write to a output file of length 80 bytes.
the input file has many records each 4 bytes of data.

input file:

ADAM
BASU
DAVE
JOHN
MARY
NICK
RAJA
SARA
......
.......

the output file should look like below...

INCLUDE COND=(1,4,EQ,C'ADAM,BASU,DAVE',
OR,1,4,EQ,C'JOHN,MARY,NICK',
OR,1,4,EQ,C'RAJA,SARA'),FORMAT=SS

Regards,
Mohamed

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon Sep 05, 2016 7:29 pm

why not look at other sort statements, such as JOIN,
where instead of the risk of creating a control card which would exceed the allowable length (or number of) control cards

JOIN would allow you to use the complete file of 4 char as a file and use it to match against another imput file.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Gentermen
Member
Posts: 2
Joined: Wed Aug 16, 2017 8:59 am
Contact:

Post by Gentermen » Wed Aug 16, 2017 10:03 am

I know what you guys think and tell others is very helpful.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others