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
 

 

Different record type problem

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Different record type problem
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    Post subject: Re: Different record type problem
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    Post subject: Reply to: Different record type problem
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    Post subject:
Reply with quote

Thanks a lot
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 19, 2008 1:48 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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