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
 

 

[Solved]Convert three records to one record

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

New User


Joined: 15 Sep 2005
Posts: 17

PostPosted: Thu Sep 15, 2005 6:25 pm    Post subject: Convert three records to one record
Reply with quote

Hi,

My requirement is to convert three records from input file to output file.

i.e

I/p file

Rec1 - ABC
Rec2 - DEF
Rec3 - GHI
Rec4 - JKL
Rec5 - MNO
Rec6 - PQR

O/p Should be like

Rec1 - ABCDEFGHI
Rec2 - JKLMNOPQR

Is there any possibility to do this with a JCL?

Thanks in Advance.

Regards,
Meena.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 23, 2005 3:20 am    Post subject:
Reply with quote

Meena,

You can do this with DFSORT's ICETOOL, but you need to tell me the RECFM and LRECL of your input file before I can show you how.
Back to top
View user's profile Send private message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Thu Sep 29, 2005 11:54 am    Post subject: Re: Convert three records to one record
Reply with quote

Hi Frank,

I am also having the same requirement.

Recfm: FB, Lercl:80

Can u please give me the sample code for this?

Thanks and Regards,
Suganthy.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Thu Sep 29, 2005 1:26 pm    Post subject: Re: Convert three records to one record
Reply with quote

If I m not wrong.... Its a two step approach,
1> Firstly I/P file have to be divided into three files containing records according to their rec number.
In this case First File having Rec Number 1, 4, 7, 10...onwards.
Second File ...2, 5, 8, 11.....
Third File ....3, 6, 9, 12.......

DFSORT's SPLIT verb can be used for this to achieve.

2> Second step is to combine the records from three file into one file, i.e. O/P File, for that another field can be added in the files as rec number.
Then recs from the three files can be combined basis on rec number.

DFSORT's SPLICE should be used for that.

Frank.... Do we have any other direct step for this......

Regards,

Priyesh.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Thu Sep 29, 2005 2:12 pm    Post subject: Re: Convert three records to one record
Reply with quote

Code below is for the I/P rec example given by the poster in original query.
LRCEL=80 & RECFM=FB assumed.

Code:
//STEP1 EXEC PGM=ICEMAN                                 
//SYSOUT DD SYSOUT=*                                   
//SORTIN DD DSN=USERID.RECORDS.INPUT,DISP=OLD         
//OUT1 DD DSN=USERID.RECORDS.SPLIT1,
//        DISP=(NEW,CATLG), 
//        SPACE=(TRKS,(100,100)),UNIT=SYSDA                 
//OUT2 DD DSN=USERID.RECORDS.SPLIT2,
//        DISP=(NEW,CATLG), 
//        SPACE=(TRKS,(100,100)),UNIT=SYSDA       
//OUT3 DD DSN=USERID.RECORDS.SPLIT3,
//        DISP=(NEW,CATLG), 
//        SPACE=(TRKS,(100,100)),UNIT=SYSDA           
//SYSIN DD *                                           
  SORT FIELDS=(1,3,FS,A)                               
  OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT                 
/*                                                     
//*                                                     
//STEP2    EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                             
//DFSMSG    DD  SYSOUT=*                                             
//IN1    DD DSN=USERID.RECORDS.SPLIT1,DISP=SHR                       
//IN2    DD DSN=USERID.RECORDS.SPLIT2,DISP=SHR                       
//IN3    DD DSN=USERID.RECORDS.SPLIT3,DISP=SHR                       
//TMP1   DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//TMP2   DD DSN=&&TEMP2,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//TMP3   DD DSN=&&TEMP3,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT    DD DSN=USERID.RECORDS.OUT,DISP=(NEW,CATLG),                 
//        SPACE=(CYL,(5,5)),UNIT=SYSDA                               
//TOOLIN DD *                                                       
 COPY FROM(IN1) TO(TMP1) USING(CTL1)                                 
 COPY FROM(IN2) TO(TMP1) USING(CTL2)                                 
 SPLICE FROM(TMP1) TO(TMP2) ON(7,8,PD) WITH(4,3) USING(CTL3)         
 COPY FROM(TMP2) TO(TMP3) USING(CTL4)                               
 COPY FROM(IN3) TO(TMP3) USING(CTL5)                                 
 SPLICE FROM(TMP3) TO(OUT) ON(10,8,PD) WITH(7,3) USING(CTL6)         
/*                                                                   
//CTL1CNTL DD *                                 
  OUTREC FIELDS=(1:1,3,7:SEQNUM,8,PD)           
/*                                               
//CTL2CNTL DD *                                 
  OUTREC FIELDS=(4:1,3,7:SEQNUM,8,PD)           
/*                                               
//CTL3CNTL DD *                                 
 OUTFIL FNAMES=TMP2,OUTREC=(1,6)                 
/*                                               
//CTL4CNTL DD *                                 
  OUTREC FIELDS=(1:1,6,10:SEQNUM,8,PD)           
/*                                               
//CTL5CNTL DD *                                 
  OUTREC FIELDS=(7:1,3,10:SEQNUM,8,PD)           
/*                                               
//CTL6CNTL DD *                                 
 OUTFIL FNAMES=OUT,OUTREC=(1,9)                 
/*                                               
//                                                                       


Input Rec:
Code:
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
YZ1
234


Output:
Code:
ABCDEFGHI
JKLMNOPQR
STUVWXYZ1


Regards,

Priyesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 29, 2005 9:14 pm    Post subject:
Reply with quote

Here's a much more efficient way to do this with DFSORT's ICETOOL:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
* Reformat each set of three records to:
* xxx|bbb|bbb|...|seqnum
* bbb|yyy|bbb|...|seqnum
* bbb|bbb|zzz|...|seqnum
COPY FROM(IN) TO(T1) USING(CTL1)
* Splice the records on seqnum to get:
* xxx|yyy|zzz|...|seqnum
* Remove seqnum
SPLICE FROM(T1) TO(OUT) ON(81,5,ZD) -
  WITHEACH WITH(4,3) WITH(7,3) USING(CTL2)
/*
//CTL1CNTL DD *
* Add seqnum1 in 81-85
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,5,ZD,START=0)),
* Get x=seqnum1//3 in 81-85
     IFTHEN=(WHEN=INIT,OVERLAY=(81:81,5,ZD,MOD,+3,TO=ZD,LENGTH=5)),
* If x=0, reformat the input record to:
* xxx|bbb|bbb|...|seqnum2
     IFTHEN=(WHEN=(81,5,ZD,EQ,+0),BUILD=(1:1,3,81:SEQNUM,5,ZD)),
* If x=1, reformat the input record to:
* bbb|yyy|bbb|...|seqnum2
     IFTHEN=(WHEN=(81,5,ZD,EQ,+1),BUILD=(4:1,3,81:SEQNUM,5,ZD)),
* If x=2, reformat the input record to:
* bbb|bbb|zzz|...|seqnum2
     IFTHEN=(WHEN=(81,5,ZD,EQ,+2),BUILD=(7:1,3,81:SEQNUM,5,ZD))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*


You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000088
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 30, 2005 1:28 pm    Post subject: Re: Convert three records to one record
Reply with quote

Thanks Frank....Thats why I love watching DFSORTs Queries.....

Regards,

Priyesh.
Back to top
View user's profile Send private message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Fri Sep 30, 2005 2:10 pm    Post subject: Re: Convert three records to one record
Reply with quote

Hi,

Thank so much Priyesh and Frank.

Dfsort is really good and interesting.

Thanks and Regards,
Suganthy.
Back to top
View user's profile Send private message
meenasomu

New User


Joined: 15 Sep 2005
Posts: 17

PostPosted: Fri Sep 30, 2005 9:30 pm    Post subject: Re: Convert three records to one record
Reply with quote

Thank You So much Frank and Priyesh.

ICETOOL is amazing with its options...Thanks a lot to you.
icon_biggrin.gif

Regards,
Meena.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 30, 2005 9:37 pm    Post subject:
Reply with quote

Quote:
Dfsort is really good and interesting.


Quote:
ICETOOL is amazing with its options


Glad you like them! As the developer responsible for DFSORT's ICETOOL and many of the DFSORT functions, it's quite rewarding to hear comments like that. icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Nov 20, 2010 3:29 am    Post subject:
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010), you can now use the new RESIZE operator of DFSORT's ICETOOL to do this more easily like this:

Code:

//NEW EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
RESIZE FROM(IN) TO(OUT) TOLEN(9) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,3)
  OUTFIL FNAMES=OUT,OVERLAY=(80:X)
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Sat Nov 20, 2010 1:27 pm    Post subject: Reply to: Convert three records to one record
Reply with quote

with the deepest respect
grateful for the honor and the opportunity bestowed on Us
We are proud to announce another resurrection after

Code:

...          5 year(s) - (months difference / 12 )
...          5 year(s) - (difference )
...         62 months
...       1876 days
...      45029 hours
...    2701792 minutes
...  162107520 seconds


icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Nov 22, 2010 11:39 pm    Post subject:
Reply with quote

Enrico,

What's your point? Are you implying there's something wrong with showing a newly available better solution to an old problem? Why?

People do search these boards and find old threads, you know, so what's wrong with keeping them up to date?
Back to top
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Wed Nov 24, 2010 10:18 am    Post subject: Reply to: Convert three records to one record
Reply with quote

i definitely did search an watch this thread for problem of mine .... thanks for the resurrection(O my DFSORT almighty! with all due respects) icon_biggrin.gif .... i wish i take my job as seriously as you do frank icon_surprised.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 24, 2010 11:59 pm    Post subject:
Reply with quote

Thanks for the encouragement. icon_smile.gif
Back to top
View user's profile Send private message
prasadplease

New User


Joined: 02 Sep 2006
Posts: 31
Location: Mumbai

PostPosted: Wed Dec 01, 2010 3:13 pm    Post subject:
Reply with quote

Frank is Mr. DFSORT!!
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 Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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