Parsing occurences of moveable data.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Sayton
Member
Posts: 10
Joined: Tue May 05, 2009 6:52 pm

Parsing occurences of moveable data.

Post by Sayton » Tue May 05, 2009 7:04 pm

Hi....

i have a series of FB 80 records, in which some, but not all, have, at a variable position the characters ".R1", ".R2", or ".R3".
I want to write out only records which have one of the ".R" variants, AND
a 4 byte blank field 7 bytes beyond where the ".R" variant started.
I've tried several (thousand?) variants on
PARSE=(%=(STARTAT=C'.R1',FIXLEN=3),
%01=(ADDPOS=6,FIXLEN=4),
%=(ABSPOS=1,STARTAT=C'.R2',FIXLEN=3),
%02=(ADDPOS=6,FIXLEN=4)),
BUILD=(%01,%02,
9:1,80))
to form an "intermediate" record bering "flags" and the original data, hoping to use OUTREC processing to select only those "tagged" records.

I strongly suspect I may be barking up a blue herring!
Can anyone help?

Steve
The only stupid question is the one you DON'T ask!

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue May 05, 2009 8:01 pm

Please show me an example of your input records and what you expect for output. Show all of the variations you need to handle in the example.
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

Sayton
Member
Posts: 10
Joined: Tue May 05, 2009 6:52 pm

Post by Sayton » Tue May 05, 2009 8:20 pm

Frank....
10 sample data records follow (FB/80, trailing blanks)-

FSH1.P0.SHOPPER.GE.NDM.TRANS.NEIL 300316 08/04/08
FSH1.P0.SHOPPER.NBS.MASTER.R1.BKUP.CPSFPS 300884 06/07/04
FSH1.P0.MERCH.NBS.MASTER.R1.FRED 301049 06/11/29
FSH1.P0.SHOPPER.NBS.MASTER.R2.BKUP.CPSFPS 300884 06/07/04
FSH1.P0.SHOPPER.NBS.MASTER.R2.COMP.FTO 301089 06/11/29
FSH1.P0.SHOPPER.NBS.MASTER.R3.BKUP.CPSFPS 300884 06/07/04
FSH1.P0.SHOPPER.TRANS.R3.BKUP 301049 06/11/29
FSH1.P0.SHOPPER.NBS.MAST.R4.BKUP.CPSFPS 300884 06/07/04
FSH1.P0.SHOPPER.NBS.MASTER.R2.BKUP(0) 301089 06/11/29
FSH1.P0.SHOPPER.PAY.PROT.R9.TRANS 300444 07/10/30

I want to output only records with ".R1", ".R2", or ".R3" at any position, AND 4 blank characters at +5 after the end of the ".Rn" character string.

In the above 10 records, I would only require records 2 and 6.

Hoping this helps....
The only stupid question is the one you DON'T ask!

Sayton
Member
Posts: 10
Joined: Tue May 05, 2009 6:52 pm

Post by Sayton » Tue May 05, 2009 8:23 pm

Frank - I meant records 3 and 7 should be selected (aging assembler programmers count from zero!).
Sorry!

Steve
The only stupid question is the one you DON'T ask!

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue May 05, 2009 9:58 pm

Here's a DFSORT job that will do what you asked for:

Code: Select all

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,80,SS,EQ,C'.R1',OR,
                1,80,SS,EQ,C'.R2',OR,
                1,80,SS,EQ,C'.R3')
  INREC PARSE=(%=(ENDBEFR=C'.R1',ENDBEFR=C'.R2',ENDBEFR=C'.R3'),
    %=(FIXLEN=5),%01=(FIXLEN=5)),
    OVERLAY=(81:%01)
  OUTFIL INCLUDE=(81,4,CH,EQ,C' ')
/*
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

Sayton
Member
Posts: 10
Joined: Tue May 05, 2009 6:52 pm

Post by Sayton » Wed May 06, 2009 1:58 pm

Frank....
So blindingly simple and beautifully complex.
It workls (of course).
Thanks for your help!

Steve
The only stupid question is the one you DON'T ask!

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed May 06, 2009 8:10 pm

Glad to help. By the way, I realized later that there's a slightly simpler solution as follows:

Code: Select all

  OPTION COPY                                                       
  INCLUDE COND=(1,80,SS,EQ,C'.R1',OR,                               
                1,80,SS,EQ,C'.R2',OR,                               
                1,80,SS,EQ,C'.R3')                                  
  INREC PARSE=(%=(ENDBEFR=C'.R1',ENDBEFR=C'.R2',ENDBEFR=C'.R3'),    
    %01=(ADDPOS=5,FIXLEN=5)),                                       
    OVERLAY=(81:%01)                                                
  OUTFIL INCLUDE=(81,4,CH,EQ,C' ')                                  
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

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others