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

Different record type problem


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

New User


Joined: 08 Aug 2007
Posts: 5
Location: Kolkata

PostPosted: Wed Jun 25, 2008 11:12 am
Reply with quote

Hi,

I have a file which has records with different record types i.e for a single account number we can have record type 1,3,5,7,12. For example :

Account Number Rec-Type
001 01
001 03
001 12
002 01
002 07
007 01
008 01
008 05

Now for any account number, a record with record-type 1 is mandatory.Other record-type may or maynot be present. All record-type
have different layout and have only account number and rec-type as the common fields.

My requirement is that I need to check the account number for record-type 1 is satisfying some condition or not.If is is then I need to get the other record-type records for that particular account.

For ex. Lets say we have a field in Record-type 1 layout called "Minimum".
Say I check whether for account number 001 the Minimum > 10 or not.

If the Minimum for account number 001 > 10 then I need the record-type 3 and record-type 12 for the account.

Is there any way we can use SORT to get such records ?
Back to top
View user's profile Send private message
Vasukip
Currently Banned

New User


Joined: 17 Jun 2008
Posts: 48
Location: Chennai

PostPosted: Wed Jun 25, 2008 6:47 pm
Reply with quote

Hi,
Can you provide some sample Input Output for this ?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 25, 2008 9:08 pm
Reply with quote

Pratikshya,

The following DFSORT/ICETOOL JCL will give you the desired results. I assumed that the input file FB recfm and 80 bytes in lrecl and record type starts in pos 5 and is byte in length and the MINIMUM field starts in pos 15 and also 2 bytes

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD *                                                     
001 01        20                                                   
001 03                                                             
001 12                                                             
002 01        05                                                   
002 07                                                             
007 01        15                                                   
008 01        50                                                   
008 03                                                             
008 12                                                             
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  SPLICE FROM(IN) TO(OUT) ON(81,8,CH) KEEPNODUPS WITHALL -         
  WITH(1,80) KEEPBASE USING(CTL1)                                   
//CTL1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),               
  IFTHEN=(WHEN=(5,2,CH,EQ,C'01'),OVERLAY=(81:SEQNUM,8,ZD,5,2,15,2)),
  IFTHEN=(WHEN=NONE,OVERLAY=(89:SEQNUM,8,ZD,                       
           81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))                   
                                                                   
  SORT FIELDS=COPY                                                 
  OUTFIL FNAMES=OUT,BUILD=(1,80),                                   
  INCLUDE=(91,2,ZD,GT,10,AND,5,2,SS,EQ,C'03,12')                   
/*                                                                 


The output from this job is

Code:

001 03
001 12
008 03
008 12


Hope this helps...

Cheers
Back to top
View user's profile Send private message
Pratikshya

New User


Joined: 08 Aug 2007
Posts: 5
Location: Kolkata

PostPosted: Thu Jun 26, 2008 11:33 am
Reply with quote

Thanks a lot
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Sep 19, 2008 1:48 am
Reply with quote

You can do this kind of thing more easily 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 *
001 01        20
001 03
001 12
002 01        05
002 07
007 01        15
008 01        50
008 03
008 12
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(5,2,CH,EQ,C'01'),
    PUSH=(81:15,2))
  OUTFIL INCLUDE=(81,2,ZD,GT,10,AND,5,2,SS,EQ,C'03,12'),
    BUILD=(1,80)
/*


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

Use [URL] BBCode for External Links
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 split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top