Page 1 of 1

Extract Specific Lines from a PS file

PostPosted: Wed Aug 26, 2009 10:31 am
by samurai007
Hi,

I have 2 input files like :

File A:
******** ************************
000001 AAAAAAAAAAA
000002 BBBBBBBB
000003 CCCCCCCCC
000004 DDDDDDDDDDD
000005 EEEEEEEEEEEEEEEEE
000006 FFFFF
000007 GG
000008 HHHHHHH
******** ************************

File B:
******** ************************
000001 47215
******** ************************

I need to extract the lines from the File A, in the order as mentioned in the File B.
My output would need to look something like

File C:
******** ************************
000001 DDDDDDDDDDD (4th line)
000002 GG (7th line)
000003 BBBBBBBB (2nd line)
000004 AAAAAAAAAAA (1st line)
000005 EEEEEEEEEEEEEEEEE (5th line)
******** ************************


Any idea how this can be done using a simple ICETOOL or a DFSORT job ??

Thanks!!

Re: Extract Specific Lines from a PS file

PostPosted: Wed Aug 26, 2009 10:49 am
by samurai007
Sorry about the format of file B.
File B would be of the format

******** ************************
000001 4
000002 7
000003 2
000004 1
000005 5
******** ************************

Re: Extract Specific Lines from a PS file

PostPosted: Wed Aug 26, 2009 8:52 pm
by Frank Yaeger
Is the first column (000001, etc) actually part of each input file?

What is the RECFM and LRECL of the input file?

What is the maximum number of records in fileB?

What is the starting position, length and format of the 4, 7, etc numbers in fileB?

Re: Extract Specific Lines from a PS file

PostPosted: Mon Aug 31, 2009 5:51 pm
by samurai007
Is the first column (000001, etc) actually part of each input file?


No. They are the line numbers. You can ignore them.


What is the RECFM and LRECL of the input file?


LRECL = 80
RECFM = FB

What is the maximum number of records in fileB?


It is not fixed. It can be anything between 1 and 1 million.


What is the starting position, length and format of the 4, 7, etc numbers in fileB?


Starting position is '1', and length can be max of 6 digits. Format would be Integer type with leading zeros removed.

Is there anything else i failed to mention ?

Re: Extract Specific Lines from a PS file

PostPosted: Mon Aug 31, 2009 10:25 pm
by skolusu
samurai,

Create the extract record number file also as 80 bytes and you can concatenate it to the original input file. we also concatenate a single record 'hdr' before each file so that the group function can use that as an indicator to distinguish as to which file the record belongs to



//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD *                                                       
HDR                                                                   
//         DD *                                                       
AAAAAAAAAAA                                                           
BBBBBBBB                                                               
CCCCCCCCC                                                             
DDDDDDDDDDD                                                           
EEEEEEEEEEEEEEEEE                                                     
FFFFF                                                                 
GG                                                                     
HHHHHHH                                                               
//         DD *                                                       
HDR                                                                   
//         DD *                                                       
4                                                                     
7                                                                     
2                                                                     
1                                                                     
5                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
  SELECT FROM(IN) TO(OUT) ON(82,8,CH) FIRSTDUP USING(CTL1)             
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),                   
  PUSH=(81:ID=1,SEQ=8)),                                               
  IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(82:+1,ADD,1,8,UFF,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,OMIT=(1,3,CH,EQ,C'HDR')                           
/*


The output from this job is

AAAAAAAAAAA         
BBBBBBBB           
DDDDDDDDDDD         
EEEEEEEEEEEEEEEEE   
GG