IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy a particular column based on PARM value


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
brindhamohan

New User


Joined: 11 May 2016
Posts: 6
Location: USA

PostPosted: Wed May 11, 2016 8:49 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Wed May 11, 2016 11:21 am
Reply with quote

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
View user's profile Send private message
brindhamohan

New User


Joined: 11 May 2016
Posts: 6
Location: USA

PostPosted: Wed May 11, 2016 7:09 pm
Reply with quote

Thanks, Bill! What do you mean by "JPn value"?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2573
Location: NYC,USA

PostPosted: Wed May 11, 2016 8:35 pm
Reply with quote

How about doing some research now?
Using SET and PROC symbols in control statements
Back to top
View user's profile Send private message
John Del

New User


Joined: 27 Apr 2012
Posts: 42
Location: NY

PostPosted: Wed May 11, 2016 8:50 pm
Reply with quote

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
View user's profile Send private message
brindhamohan

New User


Joined: 11 May 2016
Posts: 6
Location: USA

PostPosted: Thu May 12, 2016 2:56 am
Reply with quote

ok.. Thanks everyone!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Column names in SYSIBM tables DB2 5
This topic is locked: you cannot edit posts or make replies. Is there a way to restrict user login... All Other Mainframe Topics 11
No new posts REMOVE DUPLICATE RECORDS BASED ON A S... DFSORT/ICETOOL 4
No new posts Using sort on VB records based on off... DFSORT/ICETOOL 6
This topic is locked: you cannot edit posts or make replies. Copy list of files from PS to another... CLIST & REXX 11
Search our Forums:

Back to Top