Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to format using DFSORT

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

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Tue Sep 07, 2010 7:28 pm    Post subject: How to format using DFSORT
Reply with quote

Hi I have requirement like below, could anyone help me to write sort for this,

Input file1,

1010
2020
3030

Input file2,

1010001
1010002
.
.
1010999
2020001
.
.
2020999
3030001
.
.
3030999

Output,

1010 2020 3030
-------- --------- ------
001 001 001
002 002 002
. . .
. . .
. . .
999 999 999

(input File 1 should come as header)
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: Tue Sep 07, 2010 11:21 pm    Post subject:
Reply with quote

Do you always have THREE input records, or can there be different numbers of input records (if so, what is the maximum number)?

What is the RECFM and LRECL of the input file? What RECFM and LRECL do you want for the output file?
Back to top
View user's profile Send private message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Wed Sep 08, 2010 1:23 pm    Post subject:
Reply with quote

Input record(max = 5) may differ everytime...but it will always have 4 char(eg: 1010).


Input
RECFM = VB
LRECL = 656

Output
RECFM = FB
LRECL = 80
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 Sep 08, 2010 11:27 pm    Post subject:
Reply with quote

Hmmm ... now that I look at this some more, I'm a bit confused.

What is the relationship between file1 and file2? Do the keys in file match the keys in file2 one for one? Why do you need to use file1 at all if the keys are available in file2? Given each key in file1, why couldn't you just generate the columns for each key with the seqnos. Why would you even need file2?

You need to do a better job of explaining what you're trying to accomplish.
Back to top
View user's profile Send private message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Thu Sep 09, 2010 4:55 pm    Post subject:
Reply with quote

Hi Frank, I will explain you my reuirement clealy with example,

Please leave(not reuired) the input file 1.

Say We have only input file 2, it is having record like below,

5252001
5252003
5252008
2323018
2323079
.
.
.

I need output like below,

5252 2323 . .
------ ------- -----------
001 018 .
003 079 .
008 .

I think this would be clear for you.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Sep 09, 2010 8:36 pm    Post subject:
Reply with quote

Senthilkumar k,
Here is one way to get expected results with multiple pass. I tried to reduce number of pass but no luck icon_sad.gif

Assumption :- Input and Output are FB 80.
Question :- Do you really need those dash lines '-' in the output?

Code:
//STEP01   EXEC  PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN) TO(T1) USING(CTL1)                                       
 SPLICE FROM(T1) TO(T2) ON(81,2,CH) WITHANY KEEPNODUPS -               
     WITH(09,08) WITH(17,08) WITH(25,08) WITH(33,08)                   
 COPY FROM(T2) TO(OUT) USING(CTL2)                                     
/*                                                                     
//IN     DD *                                                           
5252001
5252003
5252008
2323018
2323079
1111001
1111002
1111003
2222001
2222002
2222003
2222004
3333001
3333002
3333003
3333004
3333005
3333006
3333007
3333008
3333009
3333010
/*                                                                     
//OUT     DD SYSOUT=*                                                   
//T1       DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)   
//T2       DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)   
//CTL1CNTL DD *                                                         
 OPTION COPY                                                           
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD,RESTART=(1,4))),       
       IFTHEN=(WHEN=GROUP,BEGIN=(81,2,ZD,EQ,1),PUSH=(83:ID=2))         
 OUTREC IFTHEN=(WHEN=(83,02,ZD,EQ,01),BUILD=(1,7,80:X,81,2)),           
        IFTHEN=(WHEN=(83,02,ZD,EQ,02),BUILD=(08X,09:1,7,1X,80:X,81,2)),
        IFTHEN=(WHEN=(83,02,ZD,EQ,03),BUILD=(16X,17:1,7,1X,80:X,81,2)),
        IFTHEN=(WHEN=(83,02,ZD,EQ,04),BUILD=(24X,25:1,7,1X,80:X,81,2)),
        IFTHEN=(WHEN=(83,02,ZD,EQ,05),BUILD=(32X,33:1,7,1X,80:X,81,2)) 
 OUTFIL FNAMES=T1,BUILD=(1,84)                                         
/*                                                                     
//*                                                                     
//CTL2CNTL DD *                                                         
 OPTION COPY                                                           
 OUTFIL REMOVECC,                                                       
      HEADER1=(01,04,1X,09,04,1X,17,04,1X,25,04,1X,33,04,80:X,/,       
     C'----',1X,C'----',1X,C'----',1X,C'----',1X,C'----',80:X),         
     BUILD=(1X,05,03,2X,13,03,2X,21,03,2X,29,03,2X,37,03,80:X)         
/*                                                                     
//*                                                                     

OUTPUT
Code:
5252 2323 1111 2222 3333
---- ---- ---- ---- ----
 001  018  001  001  001
 003  079  002  002  002
 008       003  003  003
                004  004
                     005
                     006
                     007
                     008
                     009
                     010


Thanks,
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 09, 2010 11:05 pm    Post subject:
Reply with quote

sqlcode1 has the right idea, but you don't need three passes - you can do it in one pass and a bit more simply with this DFSORT/ICETOOL job:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN     DD *
5252001
5252003
5252008
2323018
2323079
1111001
1111002
1111003
2222001
2222002
2222003
2222004
3333001
3333002
3333003
3333004
3333005
3333006
3333007
3333008
3333009
3333010
//OUT DD SYSOUT=*
//TOOLIN   DD *
SPLICE FROM(IN) TO(OUT) ON(81,2,CH) WITHANY KEEPNODUPS -
    WITH(9,8) WITH(17,8) WITH(25,8) WITH(33,8) USING(CTL1)
/*
//CTL1CNTL DD *
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD,RESTART=(1,4))),
       IFTHEN=(WHEN=GROUP,BEGIN=(81,2,ZD,EQ,1),PUSH=(83:ID=2)),
       IFTHEN=(WHEN=(83,2,ZD,EQ,2),OVERLAY=(9:1,7,1:8X)),
       IFTHEN=(WHEN=(83,2,ZD,EQ,3),OVERLAY=(17:1,7,1:16X)),
       IFTHEN=(WHEN=(83,2,ZD,EQ,4),OVERLAY=(25:1,7,1:24X)),
       IFTHEN=(WHEN=(83,2,ZD,EQ,5),OVERLAY=(33:1,7,1:32X))
 OUTFIL FNAMES=OUT,REMOVECC,
      HEADER1=(1,4,X,9,4,X,17,4,X,25,4,X,33,4,/,
      4C'-',X,4C'-',X,4C'-',X,4C'-',X,4C'-'),
     BUILD=(X,5,3,2X,13,3,2X,21,3,2X,29,3,2X,37,3,80:X)
/*
Back to top
View user's profile Send private message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Thu Sep 09, 2010 11:21 pm    Post subject:
Reply with quote

Thanks sqlcode and frank....Both codes are working fine... icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Sep 09, 2010 11:38 pm    Post subject:
Reply with quote

Frank,
Thanks for the correction.

Initially, I tried to use the single pass but it didn't work . I realized my mistake after going through your card.

Thanks,
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 09, 2010 11:50 pm    Post subject:
Reply with quote

Yes, you can do a lot before and after SPLICE with DFSORT statements in xxxxCNTL. But your approach was good!
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 Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 0 Thu Sep 21, 2017 9:54 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us