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

Delimited File -Unable to Find solution


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Dimpy Udhani

New User


Joined: 24 Nov 2014
Posts: 3
Location: India

PostPosted: Mon Nov 24, 2014 11:40 am
Reply with quote

Hi,

I have a delimited FB file -LRECL -340 ,separated by '|' . Every feild in the record is separated by '|' .

Example
Code:

3|4|5|6|7|8|9|10|11|12|FATCA|US|3|d|xd|s|d|d|d|d|d|d|d|u|s|s|s|s|GOOD 3|4|5|6|7|8|9|10|11|12|12|s|3|d|xd|s|d|d|d|BAD                       
3|4|5|6|7|8|9|10|11|12|12|s|3|d|xd|s|d|d|d|d|d|d|d|u|s|s|s|s|BAD     
3|4|5|6|7|8|9|10|11|12|FATCA|US|3|d|xd|s|d|d|d|GOOD                 
3|4|5|6|7|8|9|10|11|12|12|s|3|d|xd|s|d|d|d|d|d|d|d|u|s|s|s|s|GOOD


No of feilds -29
Delmiter -28

I want to acheive two things
1) if the no of delimiter is 28 ,then move in correct file - file1 and if no of delimiter is not 28 ,then move in incorrect file -file2

2) If the 11th field in the correct file is FATCA , and 12th feild in the file is US ,then move in final correct file FILE 3


I have acheived 1)if the no of delimiter is 28 ,then move in correct file - file1 and if no of delimiter is not 28 ,then move in incorrect file -file2

but unable to acheive the 2 point .


1) i have acheived through the below JCL

Code:
//SYSIN DD *                                                         
  OPTION COPY                                                       
 INREC PARSE=(%=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),   
              %28=(STARTAT=C'|',FIXLEN=1),                           
              %29=(STARTAT=C'|',FIXLEN=1)),                         
  OVERLAY=(341:%28,%29)                                             
  OUTFIL FNAMES=GOOD,INCLUDE(341,1,CH,EQ,C'|',AND,342,1,CH,EQ,C' '),
  BUILD=(1,340)                                                     
  OUTFIL FNAMES=BAD,SAVE,BUILD=(1,340)                               


Kindly help me in solving the 2nd point also and if possible in the same jcl as above.

Thanks and Regards,
Dimpy Udhani
i want if 12th feild in the record is FATCA ,then move it into some other file .

Code'd
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: Mon Nov 24, 2014 1:08 pm
Reply with quote

Your File 3 is a subset of File 1. So repeat that INCLUDE= on another OUTFIL and expand it to test the two extra PARSEd fields that you want.
Back to top
View user's profile Send private message
Dimpy Udhani

New User


Joined: 24 Nov 2014
Posts: 3
Location: India

PostPosted: Mon Nov 24, 2014 2:02 pm
Reply with quote

I tried using include statement but unable to acheive the result .

Can u help with the include statement .I am new to JCL solutions .Have been trying to try different solutions through different sites.
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: Mon Nov 24, 2014 2:09 pm
Reply with quote

If you show what you tried., we can fix it. Explain what it was that didn't work.
Back to top
View user's profile Send private message
Dimpy Udhani

New User


Joined: 24 Nov 2014
Posts: 3
Location: India

PostPosted: Mon Nov 24, 2014 2:22 pm
Reply with quote

I tried with the below Jcl

Code:
OPTION COPY                                                           
NREC PARSE=(%=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
            %28=(STARTAT=C'|',FIXLEN=1),                             
            %29=(STARTAT=C'|',FIXLEN=1)),                             
OVERLAY=(341:%28,%29)                                                 
OUTFIL FNAMES=GOOD,INCLUDE(341,1,CH,EQ,C'|',AND,342,1,CH,EQ,C' '),   
BUILD=(1,340)                                                         
OUTFIL FNAMES=GOOD,INCLUDE(341,5,CH,EQ,C'FATCA',AND,342,1,CH,EQ,C' '),
BUILD=(1,340)                                                         
OUTFIL FNAMES=BAD,SAVE,BUILD=(1,340)   





Also i Tried the below Jcl where i was targetting to acheive only point 2 and not point 1


Code:
//SORTIN DD DSN=NCSD.FATCA.FILE3,DISP=SHR                               
//GOOD   DD DSN=NCSD.FATCA.FILE4,                                       
//           DISP=(OLD,CATLG,DELETE),                                   
//           SPACE=(TRK,(30,30)),                                       
//           DCB=(RECFM=FB,LRECL=340,BLKSIZE=0)                         
//SYSIN  DD *                                                           
  OPTION COPY                                                           
 INREC PARSE=(%=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),%=(STARTAT=C'|'),       
              %=(STARTAT=C'|'),%=(STARTAT=C'|'),                       
              %09=(STARTAT=C'|',FIXLEN=1),                             
              %10=(STARTAT=C'|',FIXLEN=1)),                             
 OVERLAY=(341:%09,%10)                                                 
 OUTFIL FNAMES=GOOD,INCLUDE(341,5,CH,EQ,C'FATCA',AND,342,1,CH,EQ,C' '),
 BUILD=(1,340)


Code'd
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Nov 24, 2014 6:05 pm
Reply with quote

Picky hat on (as usual): 1 - you are not wanting JCL but sort control cards (if you do not believe me look up those keywords in the JCL Language Reference manual - not a sort manual)
2 - please note that spacing is retianed when you use the code tags so use them as spaces can be important with control cards
3 - Saying it did not work is useless. Cut and paste the messgaes from your job into the reply box and use the code tags so that everything lines up.

Use the prevew button to check your post before submitting.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Nov 24, 2014 7:11 pm
Reply with quote

Quote:
...unable to acheive the result...
What does that mean ? Did you get an error ? wrong result ?

Looking at your code full of mistakes, it must be an error: 'I' missing in INREC, '=' missing in INCLUDE, FNAMES duplicated, INCLUDE conditions out of target...

Include conditions: col 341 contains the first character of parameter %28, col 342 first char of param %29.
No '|' and no FATCA there...

Why no %11 and %12 in the parse statement ?
You have FIXLEN=1 versus C'FATCA'. Do you plan to compress 5 characters into one ?

Make an effort, Please !
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: Mon Nov 24, 2014 7:43 pm
Reply with quote

You are also using the same DDName for two OUTFILs. If you want three files, you need three separate FNAMES. If you want two, you need only two OUTFILs.

As Marso indicates, you are doing nothing to actually extract any data except the bars. You need to extract the FATCA-field. You need to include it in your OVERLAY. You need to adjust your start and length for the test of it.

The FATCA data is a subset of the GOOD data. So you need the condition for the GOOD as the first part of your INCLUDE= for the third file, then the FATCA stuff.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top