Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extracting records from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Tue Jul 03, 2012 8:35 pm    Post subject: Extracting records from a file
Reply with quote

Hi all,

Can I have my following requirement done through Sort ?

Reqt :
I/P file records

ABCDEF
Line1
Line2
ENGANVADK | 27187481734718 |
Line3
Line4
ABCDEF
.
.
ABCDEF
Line1
Line2
ENGANVADK | 27187481730348 |
Line3
Line4
Line5
ABCDEF

The sequence repeats like the above .
I want the records to be extracted if I am given an account number
say, for acct no 27187481730348 I want the following records to be
extracted from the file
ABCDEF
Line1
Line2
ENGANVADK | 27187481730348 |
Line3
Line4
Line5
ABCDEF

More Details:
The acct number's position is fixed.
The file is VB . I do not know the length of any line .

[/img]
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Jul 03, 2012 9:40 pm    Post subject:
Reply with quote

Vijay Subramaniyan,

Do you have groups of records each starting with 'ABCDEF' and also ending with 'ABCDEF'?

Does the account number always have ENGANVADK at the beginning? What is the position and format of the account number? (include the RDW also as your input is VB file)

How many accounts are going to provide/pull at a time? Can you input your account numbers in a file like this ?
Code:

ENGANVADK | 27187481730348 |
ENGANVADK | 27187481730399 |
ENGANVADK | 27187481730800 |
Back to top
View user's profile Send private message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Wed Jul 04, 2012 11:12 am    Post subject: Reply to: Extracting records from a file
Reply with quote

Hi Skolusu,

Yes. The group of records start with ABCDEF and end with ABCDEF. The account number will not have always ENGANVADK, but the
account number's position will be fixed . Assume its position is 15 and of 17 bytes long. I need to extract a group of records for an account number. Extracting one set of records may be enough for me.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jul 05, 2012 5:55 am    Post subject:
Reply with quote

The start and end indicators both being the same value was not a good idea. Is there anything else on those first and last records of the group to differentiate them from each other?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jul 05, 2012 8:27 am    Post subject:
Reply with quote

Hi,

here is a way to get this started to differentiate the groups
Code:
//SORT0001 EXEC PGM=SORT               
//SORTIN   DD *                         
ABCDEF                                 
LINE1                                   
LINE2                                   
ENGANVADK | 27187481734718 |           
LINE3                                   
LINE4                                   
ABCDEF                                 
ABCDEF                                 
LINE1                                   
LINE2                                   
ENGANVADK | 27187481730348 |           
LINE3                                   
LINE4                                   
LINE5                                   
ABCDEF                                 
//SYSOUT   DD SYSOUT=*                 
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=(001,6,CH,EQ,C'ABCDEF'),               
                OVERLAY=(41:SEQNUM,1,ZD),HIT=NEXT),         
        IFTHEN=(WHEN=(41,1,CH,EQ,C'1'),OVERLAY=(43:C'$')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'2'),OVERLAY=(43:C'?')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'3'),OVERLAY=(43:C'$')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'4'),OVERLAY=(43:C'?')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'5'),OVERLAY=(43:C'$')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'6'),OVERLAY=(43:C'?')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'7'),OVERLAY=(43:C'$')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'8'),OVERLAY=(43:C'?')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'9'),OVERLAY=(43:C'$')),   
        IFTHEN=(WHEN=(41,1,CH,EQ,C'0'),OVERLAY=(43:C'?'))   
 OUTREC IFTHEN=(WHEN=GROUP,                                 
              BEGIN=(43,1,CH,EQ,C'$'),                       
                END=(43,1,CH,EQ,C'?'),                       
                PUSH=(44:ID=4))                             
/*


Gerry
Back to top
View user's profile Send private message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Thu Jul 05, 2012 10:36 am    Post subject: Reply to: Extracting records from a file
Reply with quote

Bill,

Actually the start and end indicators are different . It was my mistake.

The actual bound values would be as below :

ABCDEF
Line1
Line2
ENGANVADK | 27187481730348 |
Line3
Line4
Line5
PQRSTU


The actual problem lies in the fact that the account number is present in
the third line . Had it been in the first line , the task would have been much simpler by coding (WHEN=GROUP, PUSH ) statement .
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jul 05, 2012 11:22 am    Post subject:
Reply with quote

Hi,

try this, this will assist in selecting which group of records you need to extract

Code:
//SORT0001 EXEC PGM=SORT                   
//SORTIN   DD *                           
ABCDEF                                     
LINE1                                     
LINE2                                     
ENGANVADK | 27187481734718 |               
LINE3                                     
LINE4                                     
PQRSTU                                     
ABCDEF                                     
LINE1                                     
LINE2                                     
ENGANVADK | 27187481730348 |               
LINE3                                     
LINE4                                     
LINE5                                     
PQRSTU                                     
//SYSOUT   DD SYSOUT=*                     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                                                     
  INREC  IFTHEN=(WHEN=GROUP,                                           
              BEGIN=(1,6,CH,EQ,C'ABCDEF'),                             
               PUSH=(44:ID=4))                                         
  OUTFIL INCLUDE=(13,14,CH,EQ,C'27187481730348'),                       
         BUILD=(44,4)                                                   
//*                                                                     



Gerry
Back to top
View user's profile Send private message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Thu Jul 05, 2012 11:35 am    Post subject: Reply to: Extracting records from a file
Reply with quote

Thank you much gcicchet . This would give me the group that the account number belongs to . Is there a way to do this without any manual intervention ?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Jul 05, 2012 1:18 pm    Post subject:
Reply with quote

What manual intervention?
Back to top
View user's profile Send private message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Thu Jul 05, 2012 1:29 pm    Post subject:
Reply with quote

Hi Nic,

We need to find out the group number to which the account number belongs to and then extract the records based on the group number . correct ? Would it not need two steps ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Jul 05, 2012 6:35 pm    Post subject:
Reply with quote

Hello,

If the input has multiple account numbers and you want to extract the group of only one, how can this be done without specifying the account number "manually" icon_confused.gif

What do i not understand?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Jul 05, 2012 7:46 pm    Post subject:
Reply with quote

It's OK Dick - I had forgotten thaty he wanted to extract the details for a particular account. Yes there would have to be some sort of intervention, depending on how the acoount number is arrived at. Seems as though SYMNAMES is the candidate here.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Jul 05, 2012 8:22 pm    Post subject: Reply to: Extracting records from a file
Reply with quote

Hi Nic,

Yup, SYMNAMES sounds good, but how to provide the account number "automagically"?

Is this to be a user-initiated, on-request process or something that will run regularly only with a different account specified each time?

The more we know, the better suggestions can we make.

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jul 05, 2012 8:28 pm    Post subject:
Reply with quote

Gerry,

I missed your post earlier. A nice idea. Perhaps the shortest way of expressing it would be with MOD.

However, things move on and we file it away for another time.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jul 05, 2012 11:47 pm    Post subject:
Reply with quote

Vijay Subramaniyan,

The following DFSORT/ICETOOL JCL will give you the desired results. I assumed the following.

1. Your account number to extracted starts in position 17 for a length of 14 bytes. This based on the sample input you provided. Your sample key starts at position 13, but your input is VB so the actual position of the field is 17 ( first 4 bytes is the RDW)

2. The Account number is always the 4th record from the header in a group and you atleast 1 record after the account number belonging to the same group.


The key you need to extract need to be passed via Parm using the JP1 format.

Code:

//STEP0100 EXEC PGM=ICETOOL,PARM='JP1"27187481730348"'         
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DSN=Your Input VB file,DISP=SHR                                 
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(OUT) ON(5,12,CH) HIGHER(5) USING(CTL1) 
//*   
//CTL1CNTL DD *                                                 
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,12X,5)),                   
  IFTHEN=(WHEN=GROUP,BEGIN=(17,6,CH,EQ,C'ABCDEF'),             
  PUSH=(5:ID=8,SEQ=4)),                                         
  IFTHEN=(WHEN=GROUP,BEGIN=(13,4,ZD,EQ,4,AND,29,14,CH,EQ,JP1), 
  PUSH=(13:13,4)),                                             
  IFTHEN=(WHEN=(13,4,ZD,LT,4),OVERLAY=(13:C'0004'))             
                                                               
  OUTFIL BUILD=(1,4,17)                                         
//*                                                             
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us