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
 
Spliting an input record

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

New User


Joined: 19 Nov 2008
Posts: 90
Location: Spain

PostPosted: Fri Sep 18, 2009 4:52 pm    Post subject: Spliting an input record
Reply with quote

Maybe this seems simple, but I've had spend quite some time trying to figure how to do this with a SORT/ICTOOL and i can't seem to figure how how.

I have an input file of 20 bytes FB LRECL like this example:

Code:

key aaa ky2 ddddddd
001 xxx 000 xxxxxxx
001 xxx 001 xxxxxxx
001 xxx 002 xxxxxxx
001 xxx 003 xxxxxxx
001 xxx 004 xxxxxxx
002 xxx 000 xxxxxxx
002 xxx 001 xxxxxxx
002 xxx 002 xxxxxxx
003 xxx 001 xxxxxxx
003 xxx 002 xxxxxxx
003 xxx 004 xxxxxxx
004 xxx 099 xxxxxxx
005 xxx 010 xxxxxxx
005 xxx 015 xxxxxxx


I have a key field in bytes 1 trhough 3, and a secod key in in bytes 9 trhough 12

I need to split the file and put the first record from each key1 group into a file, and the rest of the records in the other. The outputs should look like this:

Output File 1
Code:

001 xxx 000 xxxxxxx
002 xxx 000 xxxxxxx
003 xxx 001 xxxxxxx
004 xxx 099 xxxxxxx
005 xxx 010 xxxxxxx

Output File 2
Code:

001 xxx 001 xxxxxxx
001 xxx 002 xxxxxxx
001 xxx 003 xxxxxxx
001 xxx 004 xxxxxxx
002 xxx 001 xxxxxxx
002 xxx 002 xxxxxxx
003 xxx 002 xxxxxxx
003 xxx 004 xxxxxxx
005 xxx 015 xxxxxxx


I though on using the COPY FIRST from ICETOOL and that works nice for the first record of each group,

Code:
SELECT FROM(S1DQPREV) TO(S2DQTOP1) ON(1,3,CH) FIRST(1) USING(CTL2)

//CTL2CNTL DD *                       
  SORT FIELDS=(1,3,A),FORMAT=CH


Then using FIRSTDUP for the rest of the records:

Code:
SELECT FROM(SQDQPREV) TO(S3DQREST) ON(1,3,CH) FIRSTDUP(999) USING(CTL2)


However, when i Tried that, The number don't add up:

Code:

*COPIA EL PRIMER REGISTRO PARA CADA COMBINACION OFICINA - ENTORNO           
  SELECT FROM(E1DQPREV) TO(S1DQTOP1) ON(1,3,CH) FIRST(1) USING(CTL2)                                                     
DFSORT CALL 0001 FOR SORT FROM E1DQPREV TO S1DQTOP1 USING CTL1CNTL COMPLETED
RECORD COUNT:  000000000000301                                             
NUMBER OF RECORDS RESULTING FROM CRITERIA:  000000000000296                 
OPERATION RETURN CODE:  00                                                 
                                                                           
*COPIA EL RESTRO DE LOS REGISTROS                                           
  SELECT FROM(E1DQPREV) TO(S2DQREST) ON(1,3,CH) FIRSTDUP(999) USING(CTL1)                                                 

DFSORT CALL 0002 FOR SORT FROM E1DQPREV TO S2DQREST USING CTL1CNTL COMPLETED
RECORD COUNT:  000000000000301                                             
NUMBER OF RECORDS RESULTING FROM CRITERIA:  000000000000010                 
OPERATION RETURN CODE:  00


Any advice in implementing this? I though on using HEADERS/TRAILERS from the OUTFIL operator, but i'm still elarning how to use it and I might be missing something.

Thanks a lot in advance

Best regards

Oliver
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 18, 2009 9:43 pm    Post subject:
Reply with quote

You were on the right track. Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//S1DQPREV DD DSN=...  input file
//S2DQTOP1 DD DSN=...  output file1
//S3DQREST DD DSN=...  output file2
//TOOLIN DD *
SELECT FROM(S1DQPREV) TO(S2DQTOP1) ON(1,3,CH) FIRST -
  DISCARD(S3DQREST)
/*
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 90
Location: Spain

PostPosted: Mon Sep 21, 2009 2:45 pm    Post subject:
Reply with quote

Thanks a Lot Frank. That Worked just fine

Best Regards

Oliver
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Getting Mutiple input from Panels vidyaa CLIST & REXX 12 Mon Aug 14, 2017 1:28 pm

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