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

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

$
0
0
Author: pramitdas
Subject: Reply to: how to DYNAMICALLY write sort cond to o/p file using cobol
Posted: Sun Aug 28, 2016 12:44 am (GMT 5.5)

Okay. Thanks for asking.

Please follow the below steps.

1. First define one control card or PDS member ABC or a PS file: ABC.XYZ.XYZ of 80 LRECL having the job card and below input.

ABC.XYZ.XYZ or ABC
__________________________________________________
Your job card
---------------------------------------------------
//STEPNAME --------------
//INCLUDE COND=(1,4,EQ,C'XXX1,YYY2,ZZZ1',
OR,1,4,EQ,C'XXX2,YYY2,ZZZ2',
OR,1,4,EQ,C'XXX3,YYY3'),FORMAT=SS
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=NONE
/*
__________________________________________________


2. Now read this static control card or PS file into an array IN-JCL[18] assuming that total no of lines in the control card ABC is 18.

3. Now Read the original input file of yours with an internal array of max 100 records. Say your file can contain max of 100 records. and note your array ARR [I] value.

3. Now in your logic of Cobol program , replace the value of XXX1, YYY2 etc with exact ARR [I] value. for that you need to put the column no and starting position and length.
For e.g. XXX1 resides at your control card or PS file at column 20 and row 16 , then logic should be:
MOVE ARR(1) to IN-JCL(16) (20:04 ) ------> 4 is the length of the name ( ADAM, BASU etc).
MOVE ARR(2) to IN-JCL(16) (26:04 )
and So on

4. Then write the value of IN-JCL(I) to OUT-JCL(I) which you are looking for.

This way you can dynamically prepare the exact job. Any doubt please let me know.

Thanks,
Pramit


Viewing all articles
Browse latest Browse all 8500

Trending Articles