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

Include cond for VB file.


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

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Sun Sep 30, 2012 12:00 am
Reply with quote

Hi,
I am trying to extract records from a VB file which has different record type. I need to extract the reference number, if the product code is 'xxxx'. The product code is in different position for each record type.

The file has three record types.
If record type is 'A', the reference number starts from 26 and is 5 byte long. The product code starts from 31 and is 4 bytes.
If record type is 'B', the reference number starts from 40 and is 5 byte long. The product code starts from 45 and is 4 bytes.
I need not reffer other record types.

the record type is in position 25 and is 1 byte.
The output should be a FB file and record length should be 9 bytes.

I tried the following sort card, but the include condition does not work properly. If i remove the include condition, i get the formated records for all the records in file. If i have the include condition i get empty file.
Code:
//SYSIN   DD *                                                   
      INREC IFTHEN=(WHEN=(29,1,CH,EQ,C'A'),                   
            OVERLAY=(5:30,9)),                                 
            IFTHEN=(WHEN=(29,1,CH,EQ,C'B'),                                 
            OVERLAY=(5:44,9)),                                 
            IFTHEN=(WHEN=NONE,                                      
            OVERLAY=(5:9C' '))                                 
      SORT FIELDS=(5,9,CH,A)                
   INCLUDE COND=(10,4,CH,EQ,C'xxxx')                                   
      OUTFIL FNAMES=SORTOUT,VTOF,OUTREC=(5,9)

/*

I get the following O/P if i remove the Include condition statement:
(Lrecl=9,Recfm=FB,Dsorg=ps)
refr1xxxx
refr2xxxx
refr3yyyy
refr4zzzz
refr5cccc


If i retain the include condition, i get empty output.

Can anyone let me know what is wrong in the above sort card.

Thanks in advance.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2012 12:14 am
Reply with quote

Hello,

Did you remember to increase the positions by 4 to allow for the RDW?
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Sun Sep 30, 2012 12:19 am
Reply with quote

Yes. I had added +4 bytes, for all the positions.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2012 12:29 am
Reply with quote

Hello,

Suggest you post a few of the records using HEX ON.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2012 3:05 am
Reply with quote

passion_sujesh,

Have a look at this, which describes DFSort order of processing.

It does not matter where you locate your INCLUDE statement, DFSort will process it where it always does.

So, at the time your INCLUDE was processed, the position/length you are using contained completely different data.

Try with INCLUDE= on OUTFIL instead.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2012 7:35 am
Reply with quote

Hi Bill,

Good catch icon_smile.gif

After checking the data, i was going to work thru the code icon_wink.gif

d
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Sun Sep 30, 2012 8:16 am
Reply with quote

Thanks bill.
I shall try this and will let you know if it works.
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Tue Oct 02, 2012 2:11 am
Reply with quote

Thanks Bill.
I used include in OUTFIL, and it works fine. :-)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Oct 02, 2012 7:17 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 02, 2012 10:06 pm
Reply with quote

A better approach would be to filter the records with an INCLUDE cond and build only required fields.

Code:

//SYSIN    DD *                                             
  OPTION VLSCMP,VLSHRT                                       
  INCLUDE COND=((29,1,CH,EQ,C'A',AND,35,4,CH,EQ,C'XXXX'),OR,
                (29,1,CH,EQ,C'B',AND,49,4,CH,EQ,C'XXXX'))   
                                                             
  INREC IFTHEN=(WHEN=(29,1,CH,EQ,C'A'),BUILD=(1,4,30,9)),   
        IFTHEN=(WHEN=(29,1,CH,EQ,C'B'),BUILD=(1,4,44,9))     
                                                             
  SORT FIELDS=(5,9,CH,A)                                     
  OUTFIL VTOF,BUILD=(5,9)                                   
//*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top