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

copy data into different format


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

New User


Joined: 14 Feb 2005
Posts: 17

PostPosted: Thu May 31, 2012 11:25 pm
Reply with quote

Hi All,

I have a sequential file like

SSN ctrlnum
111111111 001
111111111 441
111111111 123
222222222 002
333333333 134

but I want copy the records from above file to another sequenctial file like

SSN ctrl1 ctrl2 ctrl3 ctrl4 ctrl5 .... ctrl10
111111111 001 441 123
222222222 002
333333333 134


is this possible to do using the DFSORT utilities? if yes please let me know how to do?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jun 01, 2012 12:10 am
Reply with quote

suresh111,
what is the maximum number of "ctrlnum" for any given SSN value? You show that in your expected output you want ctrl1 through ctrl10. Does that mean max. 10 control number per SSN?

What is the input file RECFM/LRECL and expected output file's RECFM/LRECL. What is the format of the input fields?

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 01, 2012 12:54 am
Reply with quote

Hello,

While you do not post often, you have been here 7 years.

Is there some reason you did not use the Code tag? It makes things so much easier for those who want to help. . .

This is how your post would appear with the Code tag and proper spacing:
Quote:
I have a sequential file like

Code:
SSN       ctrlnum
111111111 001
111111111 441
111111111 123
222222222 002
333333333 134
but I want copy the records from above file to another sequenctial file like

Code:
SSN       ctrl1 ctrl2 ctrl3 ctrl4 ctrl5 .... ctrl10
111111111 001   441   123
222222222 002
333333333 134


There is a Preview function so you can see your post as it will appear to the forum. Once you have what you want, Submit.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Jun 01, 2012 8:21 am
Reply with quote

Suresh111,

I created below mentioned sort card as per your example.

Code:
//STEP010  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD  SYSOUT=*                                               
//DFSMSG   DD  SYSOUT=*                                               
//IN        DD *                                                       
111111111 001                                                         
111111111 441                                                         
111111111 123                                                         
222222222 002                                                         
333333333 134                                                         
/*                                                                     
//OUT       DD DSN=VSEKARS.SORT.TEST,                                 
//     DISP=(NEW,CATLG,CATLG),                                         
//     DCB=(RECFM=FB,LRECL=80),                                       
//     SPACE=(CYL,(1,20),,,ROUND)                                     
//TOOLIN   DD *                                                       
   SPLICE FROM(IN) TO(OUT) ON(1,10,CH) WITHANY KEEPNODUPS -           
   USING(CTL1) WITH(1,10) WITH(11,3) WITH(15,3) WITH(19,3) -           
   WITH(24,3)  WITH(28,3) WITH(32,3) WITH(36,3) WITH(40,3) -           
   WITH(44,3)  WITH(48,3)                                             
/*                                                                     
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,10,70X,                           
                                81:1,10,91:11,3,                       
        94:SEQNUM,10,ZD,START=1,INCR=1,RESTART=(1,10))),               
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,1),           
                OVERLAY=(11:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,2),           
                OVERLAY=(15:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,3),           
                OVERLAY=(19:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,4),           
                OVERLAY=(24:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,5),           
                OVERLAY=(28:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,6),           
                OVERLAY=(32:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,7),           
                OVERLAY=(36:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,8),           
                OVERLAY=(40:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,9),           
                OVERLAY=(44:91,3)),                                     
        IFTHEN=(WHEN=(81,10,CH,EQ,1,10,CH,AND,94,10,ZD,EQ,10),   
                OVERLAY=(48:91,3))                               
/*                                                               

Output:

Code:

111111111 001 441 123           
222222222 002                   
333333333 134   


Note: Input file should be in sorted order of SSN fields
Back to top
View user's profile Send private message
suresh111

New User


Joined: 14 Feb 2005
Posts: 17

PostPosted: Fri Jun 01, 2012 2:20 pm
Reply with quote

Hi Sai,

Thank You, I have tried and it is working fine

Thanks,
Suresh
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 01, 2012 4:19 pm
Reply with quote

Here is a solution

Code:

//SRTJK EXEC PGM=SORT
//SORTIN DD *
111111111 001
111111111 441
111111111 123
111111111 123
111111111 323
111111111 523
111111111 623
111111111 723
111111111 823
111111111 923
222222222 002
222222222 202
333333333 134
//SORTOUT DD SYSOUT=*
//SYSOUT  DD SYSOUT=*
//SYSIN   DD *
   INREC IFTHEN=(WHEN=INIT,
     OVERLAY=(100:SEQNUM,2,ZD,RESTART=(1,10))),
     IFTHEN=(WHEN=(100,2,ZD,EQ,01),
     BUILD=(1:1,13,14:40Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,02),
     BUILD=(1:1,10,11:4Z,15:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,03),
     BUILD=(1:1,10,11:8Z,19:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,04),
     BUILD=(1:1,10,11:12Z,23:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,05),
     BUILD=(1:1,10,11:16Z,27:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,06),
     BUILD=(1:1,10,11:20Z,31:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,07),
     BUILD=(1:1,10,11:24Z,35:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,08),
     BUILD=(1:1,10,11:28Z,39:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,09),
     BUILD=(1:1,10,11:32Z,43:11,3,45Z)),
     IFTHEN=(WHEN=(100,2,ZD,EQ,10),
     BUILD=(1:1,10,11:36Z,47:11,3,45Z))
   SORT FIELDS=(1,10,CH,A)
   SUM FIELDS=(11,4,BI,15,4,BI,19,4,BI,23,4,BI,27,4,BI,
               31,4,BI,35,4,BI,39,4,BI,43,4,BI,47,4,BI)
/*


Output

Code:

111111111 001 441 123 123 323 523 623 723 823 923
222222222 002 202
333333333 134


I believe this can be done better using WHEN=GROUP + KEYBEGIN

Unfortunately It doesnt work at my shop
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 01, 2012 6:37 pm
Reply with quote

Hello,

Quote:
Unfortunately It doesnt work at my shop

Which release of which product is being used?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 01, 2012 6:41 pm
Reply with quote

dick scherrer wrote:
Hello,

Quote:
Unfortunately It doesnt work at my shop

Which release of which product is being used?


V1R10
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Jun 01, 2012 7:41 pm
Reply with quote

Suresh111,

I was doing more validations in my previous sort card. Please find the revised one.

Note: Thanks Bill for point out my mistakes.

Code:
//STEP010  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD  SYSOUT=*                                                 
//DFSMSG   DD  SYSOUT=*                                                 
//IN        DD *                                                       
111111111 001                                                           
111111111 441                                                           
111111111 123                                                           
222222222 002                                                           
333333333 134                                                           
/*                                                                     
//OUT       DD DSN=VSEKARS.SORT.TEST,                                   
//     DISP=(NEW,CATLG,CATLG),                                         
//     DCB=(RECFM=FB,LRECL=80),                                         
//     SPACE=(CYL,(1,20),,,ROUND)                                       
//TOOLIN   DD *                                                         
   SPLICE FROM(IN) TO(OUT) ON(1,10,CH) WITHANY KEEPNODUPS -             
   USING(CTL1) WITH(1,10) WITH(11,3) WITH(15,3) WITH(19,3) -           
   WITH(24,3)  WITH(28,3) WITH(32,3) WITH(36,3) WITH(40,3) -           
   WITH(44,3)  WITH(48,3)                                               
/*                                                                     
//CTL1CNTL DD *                                                         
  INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,10,70X,                         
                                81:11,3,                             
        85:SEQNUM,2,ZD,START=1,INCR=1,RESTART=(1,10))),               
        IFTHEN=(WHEN=(85,02,ZD,EQ,1),                                 
                OVERLAY=(11:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,2),                                 
                OVERLAY=(15:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,3),                                 
                OVERLAY=(19:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,4),                                 
                OVERLAY=(24:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,5),                                 
                OVERLAY=(28:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,6),                                 
                OVERLAY=(32:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,7),                                 
                OVERLAY=(36:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,8),                                 
                OVERLAY=(40:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,9),                                 
                OVERLAY=(44:81,3)),                                   
        IFTHEN=(WHEN=(85,02,ZD,EQ,10),     
                OVERLAY=(48:81,3))         
/*
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jun 01, 2012 8:16 pm
Reply with quote

Another case where RESIZE with ON field with MAXLEN needed. 36_2_18.gif

P.S. I know its easy to ask but may not be that easy...

Thanks,
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top