Picking line nbr from last record and placing it in header



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

Picking line nbr from last record and placing it in header

Postby Swati Gupta » Fri Aug 19, 2011 1:27 pm

Hi All,
I have to do the below through a single icetool step:-
The i/p file has line numbers and have to pick last line number (comma seperated file ) and place it in the header recort count which is on 5th line.
Please see the i/p file:-
-----------------------------------------------------
# ISSUER CODE: 2216317637
# JOB TYPE: ADDUPDEL
# CREATED ON: 20110817
# SEQUENCE NUMBER: 417
# RECORD COUNT: 3
# NUMBER OF FIELDS: 4
# FI ID: abscd
1,A,A,sdjsakjfkjdkfj,67
2,A,A,sdjsakjtitoire,76
3,A,A,sdjsakjyuyu,67
4,A,A,sdjsakj,4069
5,A,A,sdjsakj,38247328
6,A,sajdskdj,854385
7,A,sdjsakj,458475
--------------------------------------------
7 top lines are header info and data starts from 8th record with line number.
File has millions of record.
I need to put the last line number in record acount as it is coming incorrect through icetool step. Also file is in CSV format and have to change file in the same step.

o/p file should be like:-

-----------------------------------------------------
# ISSUER CODE: 2216317637
# JOB TYPE: ADDUPDEL
# CREATED ON: 20110817
# SEQUENCE NUMBER: 417
# RECORD COUNT: 7
# NUMBER OF FIELDS: 4
# FI ID: abscd
1,A,A,sdjsakjfkjdkfj,67
2,A,A,sdjsakjtitoire,76
3,A,A,sdjsakjyuyu,67
4,A,A,sdjsakj,4069
5,A,A,sdjsakj,38247328
6,A,sajdskdj,854385
7,A,sdjsakj,458475
--------------------------------------------
record count should be line number of last record.

I tried an icetool step to get last record in a temp file using below jcl but cant do further. Could you please help.

//JSTEP010 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD DSN=i/p file
//OUT DD DSN=&&Temp
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST
/*


Thanks,
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Picking line nbr from last record and placing it in header

 

Re: Picking line nbr from last record and placing it in head

Postby skolusu » Fri Aug 19, 2011 9:43 pm

Swati Gupta,

You haven't provided any details about the LRECL and RECFM of the input file. I assumed that your input is FB recfm and LRECL=80. The count will be updated on the 5th record at pos 16 with the leading zeroes suppressed.

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//INA      DD DSN=your input 80 byte file,DISP=SHR
//INB      DD DSN=your same input 80 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  JOINKEYS F1=INA,FIELDS=(81,08,A),SORTED                         
  JOINKEYS F2=INB,FIELDS=(01,8,A)                                 
  JOIN UNPAIRED,F1                                                 
  REFORMAT FIELDS=(F1:1,80,?,F2:9,8)                               
  INREC IFOUTLEN=80,                                               
  IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),OVERLAY=(16:82,8,ZD,M10,LENGTH=8))
//JNF1CNTL DD *                                                   
  INREC OVERLAY=(81:SEQNUM,8,ZD)                                   
//JNF2CNTL DD *                                                   
  OPTION SKIPREC=7                                                 
  INREC BUILD=(C'00000005',C'00000001')                           
  SUM FIELDS=(9,8,ZD)                                             
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Picking line nbr from last record and placing it in head

Postby Swati Gupta » Mon Aug 22, 2011 2:47 pm

Thanks Skolusu,
But my file is a variable length file and i need to update it thought the above. how would the above be modified.
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Picking line nbr from last record and placing it in head

Postby skolusu » Mon Aug 22, 2011 9:38 pm

Swati Gupta wrote:Thanks Skolusu,
But my file is a variable length file and i need to update it thought the above. how would the above be modified.


Swati Gupta,

Wouldn't it be easier if you had specified this vital piece of information in your first post itself? Use the following DFSORT Control cards

//SYSIN    DD *                                 
  OPTION COPY                                   
  JOINKEYS F1=INA,FIELDS=(05,08,A),SORTED       
  JOINKEYS F2=INB,FIELDS=(05,8,A)               
  JOIN UNPAIRED,F1                             
  REFORMAT FIELDS=(F1:1,4,F2:13,8,?,F1:13)     
  INREC IFTHEN=(WHEN=(13,1,CH,EQ,C'B'),         
  BUILD=(1,4,14,15,5,8,ZD,M10,LENGTH=8,37)),   
  IFTHEN=(WHEN=NONE,BUILD=(1,4,14))             
//JNF1CNTL DD *                                 
  INREC BUILD=(1,4,SEQNUM,8,ZD,5)               
//JNF2CNTL DD *                                 
  OPTION SKIPREC=7                             
  INREC BUILD=(1,4,C'00000005',C'00000001')     
  SUM FIELDS=(13,8,ZD)                         
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Picking line nbr from last record and placing it in head

Postby Swati Gupta » Mon Aug 22, 2011 10:05 pm

My Apologies ... i understand that it has eventually took double the time for almost the same thing.. I really appreciate. Thank You. <wink>
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post