Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort/Extract specific information from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort/Extract specific information from a file
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 Moderator


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

PostPosted: Wed Nov 15, 2006 5:08 am    Post subject:
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    Post subject: Re: Sort/Extract specific information from a file
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 Moderator


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

PostPosted: Wed Nov 15, 2006 10:34 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us