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

Updating Count After Splice


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

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Fri Oct 02, 2009 2:52 am
Reply with quote

Hi,

I have two files and would like to write on output file if they match.
I have another file it contains only trailer record. I need to update this file with actual number of matched records. Could you please help efficient way to do this.

What I know is use ICETOOL Splice operator to match two files. But to get the count use ICEMAN facility to get the count and write on to temp file. Then in next step take that temp count value and overlay on existing trailer record.

My Input files are looks like this:

File-1:

12345
12346
12348

File-2:

12345abcdtest11
12345abcetest12
12347abcdtest14
12348abcdtest14

Trailer File:

trailer00004abcd

Expected Output:

Output data file:
12345abcdtest11
12345abcetest12
12348abcdtest14

Trailer:

trailer00003abcd

It would be greatful if you can provide simple way to do this.

Regards,
Sreeni
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Oct 02, 2009 3:20 am
Reply with quote

csreenivasulu,

Please answer the following questions

1. What is the LRECL and RECFM of file1
2. What is the LRECL and RECFM of file2
3. What is the position of the key and format of the key in file1?
4. What is the position of the key and format of the key in file2?
5. Does any of the file have duplicates on the key
6. What is the LRECL and RECFM of the Matched file?
7. what is the LRECL and RECFM of the trailer file?

8. run this job and show me the sysout
Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD *               
A                             
//SORTOUT  DD SYSOUT=*       
//SYSIN    DD *               
  SORT FIELDS=COPY           
/*
Back to top
View user's profile Send private message
csreenivasulu

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Fri Oct 02, 2009 1:49 pm
Reply with quote

Hi Kolusu,
Thanks for your reply.
Please find answers for your queries below.
1. What is the LRECL and RECFM of file1

LRECL=9, RECFM=FB

2. What is the LRECL and RECFM of file2

LRECL=175,RECFM=FB

3. What is the position of the key and format of the key in file1?
POSITION OF THE KEY:1, FORMAT = CH
4. What is the position of the key and format of the key in file2?
POSITION OF THE KEY:1, FORMAT = CH
5. Does any of the file have duplicates on the key ?
yES. File 2 contains duplicates
6. What is the LRECL and RECFM of the Matched file?
LRECL=175,RECFM=FB
7. what is the LRECL and RECFM of the trailer file?
LRECL=80,RECFM=FB, Count need to put on position 5 and length 14.

8. Please find the sysout from the above job.


Display Filter View Print Options Help
-------------------------------------------------------------------------------
SDSF OUTPUT DISPLAY DEVDW14X JOB25897 DSID 104 LINE 0 COLUMNS 01- 80
COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
1ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 09:12 ON FRI OC
0 SORT FIELDS=COPY
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E9-K90007 C9-BASE E5-K18181
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
ICE088I 0 DEVDW14X.PSTP010 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ER
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXIT
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAM
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-K10929 F0-Q84357 E8-K19114
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE026I 1 SMF RECORD NOT WRITTEN TO THE SMF DATA SET(RC=20)
ICE052I 0 END OF DFSORT
******************************** BOTTOM OF DATA *******************************

Once again thanks for your help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Oct 02, 2009 9:20 pm
Reply with quote

csreenivasulu,

The following DFSORT/ICETOOL JCL will give you the desired results. I assumed the key you want to compare is 9 bytes


Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//F009     DD DSN=Your 9 byte unq key file,DISP=SHR
//F175     DD DSN=your 175 byte master file,DISP=SHR
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)   
//OUT      DD SYSOUT=*                                             
//UPDTRLR  DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  COPY FROM(F009) USING(CTL1)                                     
  COPY FROM(F175) USING(CTL2)                                     
  SPLICE FROM(TEMP) TO(OUT) ON(1,9,CH) WITH(1,175) WITH(177,1) -   
  WITHALL USING(CTL3)                                             
//CTL1CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,BUILD=(1,9,176:C'11')                         
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,OVERLAY=(176:C'22')                           
//CTL3CNTL DD *                                                   
  OUTFIL FNAMES=OUT,BUILD=(1,175),INCLUDE=(176,2,ZD,EQ,12)         
  OUTFIL FNAMES=UPDTRLR,REMOVECC,NODETAIL,BUILD=(80X),             
  INCLUDE=(176,2,ZD,EQ,12),TRAILER1=('TRLR',COUNT=(M11,LENGTH=14))
//*
Back to top
View user's profile Send private message
csreenivasulu

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Mon Oct 05, 2009 9:39 pm
Reply with quote

Hi Skolusu,

Thank you very much for your help. I ran this code and got expected results.
Back to top
View user's profile Send private message
csreenivasulu

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Tue Oct 06, 2009 1:49 am
Reply with quote

Sorry to trouble you again. As I wrote earlier I got almost the results I wanted, but I want to override the existing trailer file. The trailer file first 5 bytes contains file creation date in packed format. Would it possible with OVERLAY option. I tried with this option, but Syntax not correct.

Regards
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 06, 2009 4:21 am
Reply with quote

csreenivasulu,

Quote:
Sorry to trouble you again. As I wrote earlier I got almost the results I wanted, but I want to override the existing trailer file. The trailer file first 5 bytes contains file creation date in packed format. Would it possible with OVERLAY option. I tried with this option, but Syntax not correct.


Is it that date the current date? or any other date? Do you have any other fields that you need to retain from that trailer file?
Back to top
View user's profile Send private message
csreenivasulu

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Tue Oct 06, 2009 1:51 pm
Reply with quote

Skolusu,

This date is some other date, not current date. I have another field to retain in the file. First 5 bytes date, next 14bytes count, after that 8bytes program name.

Regards
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 06, 2009 9:37 pm
Reply with quote

csreenivasulu,

use the following JCL which will give you the desired results

Code:

//STEP0050 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=Your existing trailer file,DISP=SHR
//SORTOUT  DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)     
//SYSIN    DD *
  OPTION COPY,STOPAFT=1                                       
  OUTFIL BUILD=(C'INPDATE,C''',01,5,C'''',/,                 
                C'PGMNAME,C''',20,8,C'''',80:X)               
//*                                                           
//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*
//SYMNAMES DD DSN=&&S,DISP=SHR                                             
//F009     DD DSN=Your 9 byte unq key file,DISP=SHR
//F175     DD DSN=your 175 byte master file,DISP=SHR
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)   
//OUT      DD SYSOUT=*                                             
//UPDTRLR  DD DSN=Your existing trailer file,DISP=SHR
//TOOLIN   DD *                                                   
  COPY FROM(F009) USING(CTL1)                                     
  COPY FROM(F175) USING(CTL2)                                     
  SPLICE FROM(TEMP) TO(OUT) ON(1,9,CH) WITH(1,175) WITH(177,1) -   
  WITHALL USING(CTL3)                                             
//CTL1CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,BUILD=(1,9,176:C'11')                         
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,OVERLAY=(176:C'22')
//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT,BUILD=(1,175),INCLUDE=(176,2,ZD,EQ,12)     
  OUTFIL FNAMES=UPDTRLR,REMOVECC,NODETAIL,BUILD=(80X),         
  INCLUDE=(176,2,ZD,EQ,12),                                   
  TRAILER1=(INPDATE,COUNT=(M11,LENGTH=14),PGMNAME)             
//*                                                           
Back to top
View user's profile Send private message
csreenivasulu

New User


Joined: 09 Feb 2008
Posts: 6
Location: Mumbai

PostPosted: Thu Oct 08, 2009 1:45 am
Reply with quote

Dear Skolusu,

Thank you for your help. I have followed your instructions and it worked.

Regards
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 To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
Search our Forums:

Back to Top