MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Repeat the header depending on trailer.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tempuser
Beginner


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Mon Sep 03, 2007 1:46 pm    Post subject: Repeat the header depending on trailer. Reply with quote

Hi,
There is a file of 80 in length with FB.The file looks as

Code:

----+----1----+----2----+----3
*****************************
1                             
             A   B   C   D   
             B   B   C   D   
2                             
             C   D   G   G   
             E   F   K   R   
             G   H   L   M   


Code:

I need to produce the o/p as

1          a      b
1          c      d
1          b      b
1          c      d
2          c      d
2          g      g
2          e      f
2          k      r
2          g      h
2          l      m


The rule is ,it should pick the header record and then 2 record values (horizontal) from the trailer record.
Thanks
Tempuser
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Sep 03, 2007 3:33 pm    Post subject: Reply with quote

tempuser,

Try this untested DFSORT/ICETOOL code.

Code:

//STEP0100 EXEC PGM=ICETOOL   
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//IN       DD *               
1                             
----+----1----+----2----+----3
              A   B   C   D   
              B   B   C   D   
2                             
              C   D   G   G   
              E   F   K   R   
              G   H   L   M                                   
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                               
  SPLICE FROM(IN) TO(OUT) ON(89,8,CH) WITH(01,80) WITHALL -   
  USING(CTL1)                                                 
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,8,89:SEQNUM,8,ZD)),   
        IFTHEN=(WHEN=(1,1,CH,EQ,C' '),                         
                OVERLAY=(97:SEQNUM,8,ZD,                       
                         89:89,8,ZD,SUB,97,8,ZD,M11,LENGTH=8)),
        IFTHEN=(WHEN=NONE,                                     
                OVERLAY=(89:SEQNUM,8,ZD))                     
                                                               
  OUTFIL FNAMES=OUT,                                           
  OUTREC=(81,8,15,05,/,                                       
          81,8,23,05)                                         
/*                                                             


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tempuser
Beginner


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Tue Sep 04, 2007 2:08 pm    Post subject: Reply with quote

Thank you Kolusu!It worked fine with a little bit modification.

Thanks
Tempuser
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Sep 04, 2007 2:12 pm    Post subject: Reply with quote

Quote:

It worked fine with a little bit modification.


can you tell me what you changed so that I can update the solution with right control cards

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Sep 04, 2008 7:09 pm    Post subject: Reply with quote

You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT  DD SYSOUT=*
//SORTIN DD *
1
              A   B   C   D
              B   B   C   D
2
              C   D   G   G
              E   F   K   R
              G   H   L   M
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),
    PUSH=(1:1,1))
  OUTFIL OMIT=(15,1,CH,EQ,C' '),
    BUILD=(1,19,/,1,14,23,5)
/*


For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group