DFSORT - extract date from the HDR



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

DFSORT - extract date from the HDR

Postby zaino22 » Fri May 22, 2009 7:57 am

I have source file that contains Header '001...2009-05-20'
date is at position 30 to 39. i want to take just the date field (10 bytes along with '-'), and copy it to a GDG file. I tried DFSORT function but since i am not familiar with it much, i couldn't do it. Can someone write sample program how i can achieve it?

Thanks
zaino22
 
Posts: 7
Joined: Tue Mar 17, 2009 11:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT - extract date from the HDR

Postby zaino22 » Fri May 22, 2009 7:09 pm

I only want to copy the specific field in the header, which is the first line of the file. First line has 105 bytes, but after 62 bytes there are spaces till the end.
i tried using the following program but did not work.
Any suggestions?

//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=SOURCE.DS,DISP=SHR
//OUT DD DSN=TARGET.DS
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
INREC BUILD=(30,39)
OPTION STOPAFT=1
/*

ERROR MSG:
0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SOR*
TOUT=OUT,DYNALLOC
SORT FIELDS=COPY
F RECORD TYPE IS V - DATA STARTS IN POSITION 5
0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS
0 MISSING RDW OR DATA FOR *INREC : REASON CODE 03, IFTHEN 0
0 C5-K90014 C6-K90014 C7-K45047 C8-K90014 E9-K40168 E7-K44564
3 END OF DFSORT
zaino22
 
Posts: 7
Joined: Tue Mar 17, 2009 11:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT - extract date from the HDR

Postby Frank Yaeger » Fri May 22, 2009 8:40 pm

Your input file has RECFM=VB so you need to specify the RDW in the INREC statement. Assuming you want the output data set to have RECFM=VB, you can just change your INREC statement to:

  INREC BUILD=(1,4,30,39)       
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT - extract date from the HDR

Postby zaino22 » Fri May 22, 2009 9:11 pm

i tried following code but it captures before and after bytes as well. Now, I also want to add check if the first record contains '001 then take the date only e.g. 2009-02-04 and copy it to a GDG file without any before and after spaces.
i have tried following as well, which get rid of before bytes, but still contain after bytes.
INREC BUILD=(1,4,34,34)

Header sample:001 2009-02-05 10:55:06 MLK00 2009-02-04 SOURCE.DATASET.NAME(0)

//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=SOURCE.DS,DISP=SHR
//OUT DD DSN=TARGET.DS,
// DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=VB,LRECL=43,BLKSIZE=0,DSORG=PS),
// SPACE=(10,(1,1),RLSE),AVGREC=K
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
INREC BUILD=(1,4,30,39)
OPTION STOPAFT=1
/*
zaino22
 
Posts: 7
Joined: Tue Mar 17, 2009 11:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT - extract date from the HDR

Postby Frank Yaeger » Fri May 22, 2009 10:24 pm

When you specify 34,34, it extracts 34 bytes starting at position 34. If you only want the date, you should be using a length of 10, not 34.
That will only extract 10 bytes. Why would you use a length of 34 to extract 10 bytes?

   INREC BUILD=(1,4,34,10)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/servers/storage/supp ... tmpub.html
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT - extract date from the HDR

Postby zaino22 » Sat May 23, 2009 12:06 am

Consider this my lack of knowledge after making this change, issue is resolved. i went thru few postings on this site, and did like your suggestion on reading on the IBM tutorial 'Getting Started'. I plan to learn more on SORT, and ICETOOL. Thanks for the timely help!!!!!!!!!!
zaino22
 
Posts: 7
Joined: Tue Mar 17, 2009 11:00 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post