Extract Specific Lines from a PS file



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

Extract Specific Lines from a PS file

Postby samurai007 » Wed Aug 26, 2009 10:31 am

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!!
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extract Specific Lines from a PS file

Postby samurai007 » Wed Aug 26, 2009 10:49 am

Sorry about the format of file B.
File B would be of the format

******** ************************
000001 4
000002 7
000003 2
000004 1
000005 5
******** ************************
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extract Specific Lines from a PS file

Postby Frank Yaeger » Wed Aug 26, 2009 8:52 pm

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?
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: Extract Specific Lines from a PS file

Postby samurai007 » Mon Aug 31, 2009 5:51 pm

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 ?
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extract Specific Lines from a PS file

Postby skolusu » Mon Aug 31, 2009 10:25 pm

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                 
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post