View previous topic :: View next topic
|
Author |
Message |
brindhamohan
New User
Joined: 11 May 2016 Posts: 6 Location: USA
|
|
|
|
Hi,
I want to use SORTD to copy a particular column from a file based on a PARM value.
Code: |
INPUT:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
********************************* Top of Data
TABLENAME C01 C02 C03 C04 C05
TABLE_1 174 17 1422 1947 255
TABLE_2 462548 378163 1652738 1954311 895624
TABLE_3 83 212831 188 415 107
TABLE_4 836819 398130 1860664 1988962 844363
TABLE_5 972621 241491 1182635 1137845 659960 |
If the PARM value is C02, then I would the output to be,
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
********************************* Top of Data
TABLENAME C02
TABLE_1 17
TABLE_2 378163
TABLE_3 212831
TABLE_4 398130
TABLE_5 241491 |
If the PARM value is C05, then I would the output to be,
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
********************************* Top of Data
TABLENAME C05
TABLE_1 255
TABLE_2 895624
TABLE_3 107
TABLE_4 844363
TABLE_5 659960
|
Here is my JCL. What tweak should I do to copy the first column that contains the table name and counts column based on the PARM value?
Code: |
//SETP15 EXEC SORTD
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD DSN=TEST.INPUT.COUNT,DISP=SHR
//SORTOUT DD DSN=TEST.OUTPUT.CXX,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(20,20),RLSE),
// UNIT=DISK
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,6,SS,EQ,C'TABLE_')
OUTFIL OUTREC=(1,38)
/* |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It's not so much of a "tweak", you'll need some code.
Test your JPn value that logically indicates the column, and only BUILD with the data you need for that column.
If parm-value equal to column2, build basic data plus column2. Same for each column. |
|
Back to top |
|
|
brindhamohan
New User
Joined: 11 May 2016 Posts: 6 Location: USA
|
|
|
|
Thanks, Bill! What do you mean by "JPn value"? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
Back to top |
|
|
John Del
New User
Joined: 27 Apr 2012 Posts: 42 Location: NY
|
|
|
|
See section 8.7 of the DFSORT Application Programming Guide (at least that's the section to look at for v1r12), link to the IBM manuals are in the upper right of the forum.
JPn allows you to utilize SET/PROC symbols in DFSORT statements via the execution parm. Example for using JPn from board: ibmmainframes.com/viewtopic.php?p=334441#334441 |
|
Back to top |
|
|
brindhamohan
New User
Joined: 11 May 2016 Posts: 6 Location: USA
|
|
|
|
ok.. Thanks everyone! |
|
Back to top |
|
|
|