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

Sort/Extract specific information from a file


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

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Wed Nov 15, 2006 4:15 am
Reply with quote

I have a Fixed block 80 byte file, and need to extract only certain column of information. COLUMN position line is for reference only.

Example of input file:
Code:

 SELECT COUNTS BY BANK                                                         
                                                                               
 THERE CAN BE MORE LINES OF SUCH TEXT                                           
 BUT FIXED COLUMN POSITIONS FOR POS1,POS2,POS3                                 
 VALUES IN POS1,2,3 COLUMNS WILL BE IN UNSORTED ORDER, BUT POS1,POS2 AND POS3   
 FOLLOW RULE THAT POS2 CAN HAVE DATA ONLY IF POS1 HAVE DATA                     
                  POS3 CAN HAVE DATA ONLY IF POS1 AND POS2 ARE HAVING DATA         
 THERE IS NO POSSIBILITY OF DUPLICATE VALUE IN POS1,POS2 AND POS3 COMBINED     
THERE WILL BE ONLY NUMERICS OR SPACES  IN POS1,POS2 AND POS3
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
         POS1 POS2 POS3    COUNT     BANK   LOAD DATE      BANK NAME           
         2000 2000         002160    8999   11-17-06       MNC NAME             
         3000 1000         002249    3334   11-17-06       QPR NAME             
         1234 1000 0200    001939    4444   11-17-06       ABC NAME             
         1235 1000 0300    001994    5555   11-17-06       XYZ NAME             
         4000              002695    4444   11-17-06       ABC NAME             
         5000              002660    2234   11-17-06       XYZ NAME             
         6666 3400 0800    002597    4433   11-17-06       MNC NAME             
         7777 3500 0900    002429    4444   11-17-06       QPR NAME             
         8888 9999         002035    8989   11-17-06       ABC NAME             
         9999              002507    9898   11-17-06       XYZ NAME             
MORE TEXT MORE TEXT                                                             
                 MOR TEXT MORE TEXT                                                             
         POS1 POS2 POS3    COUNT     BANK   LOAD DATE      BANK NAME           
         4500 9890         004340    8999   11-17-06       MNC NAME             
         9984 1000         004559    3334   11-17-06       QPR NAME             
         3984 1000 0200    006939    4444   11-17-06       ABC NAME             
                                                               


Output should be Fixed Block 80 bytes with only data in POS1,POS2 , POS3 while substituting blank position with column name. Output should be sorted in order of POS1,POS2 and POS3.

Example of output:

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
123410000200                                                                   
123510000300                                                                   
20002000POS3                                                                   
30001000POS3                                                                   
398410000200                                                                   
4000POS2POS3                                                                   
45009890POS3                                                                   
5000POS2POS3                                                                   
666634000800                                                                   
777735000900                                                                   
88889999POS3                                                                   
99841000POS3                                                                   
9999POS2POS3                                                                                                                       


Can this be done with Sort/Tools?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 15, 2006 5:08 am
Reply with quote

I can't figure out what is part of the data and what isn't.

Is the following actually in the input file:

Code:

SELECT COUNTS BY BANK                                                         
                                                                               
THERE CAN BE MORE LINES OF SUCH TEXT                                           
BUT FIXED COLUMN POSITIONS FOR POS1,POS2,POS3                                 
VALUES IN POS1,2,3 COLUMNS WILL BE IN UNSORTED ORDER, BUT POS1,POS2 AND POS3   
FOLLOW RULE THAT POS2 CAN HAVE DATA ONLY IF POS1 HAVE DATA                     
                  POS3 CAN HAVE DATA ONLY IF POS1 AND POS2 ARE HAVING DATA         
THERE IS NO POSSIBILITY OF DUPLICATE VALUE IN POS1,POS2 AND POS3 COMBINED     
THERE WILL BE ONLY NUMERICS OR SPACES  IN POS1,POS2 AND POS3


If so, does it appear only once in the file or multiple times? Is it a fixed number of lines? How can we identify these header lines vs the details lines?

Is the following actually in the input file:

Code:

         POS1 POS2 POS3    COUNT     BANK   LOAD DATE      BANK NAME


Does it appear multiple times as shown?
Back to top
View user's profile Send private message
MFRASHEED

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Wed Nov 15, 2006 7:25 am
Reply with quote

Frank,

Whole part mentioned under 'input file' is part of file excluding column position line which is for reference.

Quote:

POS1 POS2 POS3 COUNT BANK LOAD DATE BANK NAME


is part of file and can appear multiple times in file. But always appears in fixed column position. Only fixed position header is this line.
Detail lines under POS1... also appear in fixed position.

Other text where i described file contents can be assumed to be part of file, as there can be variable text and this text is substituing variable text.
This text appears multiple time in file before POS1 POS2 header line. And usually is between 5 to 10 lines,


Only way to differentiate text from meaningful POS1 Header and POS1... detail lines is by checking between column position 10 - 13 for string 'POS1' or numbers, if not it is text.

Hope i answered your questions.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 15, 2006 10:34 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's NUM function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  INCLUDE COND=(10,4,FS,EQ,NUM)
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,BUILD=(1:10,4,5:15,4,9:20,4)),
    IFTHEN=(WHEN=(5,4,CH,EQ,C' '),OVERLAY=(5:C'POS2'),HIT=NEXT),
    IFTHEN=(WHEN=(9,4,CH,EQ,C' '),OVERLAY=(9:C'POS3'))
  SORT FIELDS=(1,4,CH,A,5,4,CH,A,9,4,CH,A)
/*
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top