Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy a particular column based on PARM value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
brindhamohan

New User


Joined: 11 May 2016
Posts: 3
Location: USA

PostPosted: Wed May 11, 2016 8:49 am    Post subject: Copy a particular column based on PARM value
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed May 11, 2016 11:21 am    Post subject: Reply to: Copy a particular column based on PARM value
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: 3
Location: USA

PostPosted: Wed May 11, 2016 7:09 pm    Post subject: Reply to: Copy a particular column based on PARM value
Reply with quote

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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed May 11, 2016 8:35 pm    Post subject:
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: 20
Location: NY

PostPosted: Wed May 11, 2016 8:50 pm    Post subject:
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: http://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: 3
Location: USA

PostPosted: Thu May 12, 2016 2:56 am    Post subject: Reply to: Copy a particular column based on PARM value
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us