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
 

 

Findrep & Parse to format the file

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

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Tue Mar 24, 2009 12:15 am    Post subject: Findrep & Parse to format the file
Reply with quote

Hi,

Following sort control card is used to replace double quotes & remove comma from input file
Code:
OPTION COPY
INREC FINDREP=(IN=C'"',OUT=C''),
      PARSE=(%01=(ABSPOS=4,ENDBEFR=C',',FIXLEN=11),
       %02=(ENDBEFR=C',',FIXLEN=02),
       %03=(ENDBEFR=C',',FIXLEN=02),
       %04=(ENDBEFR=C',',FIXLEN=02),
       %05=(ENDBEFR=C',',FIXLEN=09),
       %06=(ENDBEFR=C',',FIXLEN=17)),
    BUILD=(1,4,
       5:%05,
      14:%06,SFF,TO=ZD,LENGTH=17)


But i get the following error
Code:
              OPTION COPY
              INREC FINDREP=(IN=C'"',OUT=C''),
                    PARSE=(%01=(ABSPOS=4,ENDBEFR=C',',FIXLEN=11),
                    $
ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS
                     %02=(ENDBEFR=C',',FIXLEN=02),
                     $

Could you please help me in fixing this syntax error?
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Mar 24, 2009 12:40 am    Post subject:
Reply with quote

Quote:
ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS
I can't seem to locate it, but it appears that PARSE and FINDREP are mutually exclusive......
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Tue Mar 24, 2009 12:56 am    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Hi

Please ignore my question. I have modified it & worked fine


Thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Mar 24, 2009 1:09 am    Post subject: Re: Reply to: Findrep & Parse to format the file
Reply with quote

suyerasi wrote:
Please ignore my question. I have modified it & worked fine
OK, could you please post the "modified" control cards?
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: Tue Mar 24, 2009 1:22 am    Post subject:
Reply with quote

You can use FINDREP and PARSE in the same INREC statement by putting them in separate IFTHEN clauses.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Tue Mar 24, 2009 2:28 am    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Hi Frank,

Following is what i coded before you gave your comments. Let me know if this is correct.
Code:
OPTION COPY
INREC FINDREP=(INOUT=(C'"',C''))
OUTREC PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=11),
       %02=(ENDBEFR=C',',FIXLEN=02),
       %03=(ENDBEFR=C',',FIXLEN=02),
       %04=(ENDBEFR=C',',FIXLEN=02),
       %05=(ENDBEFR=C',',FIXLEN=09),
       %06=(ENDBEFR=C',',FIXLEN=17)),
BUILD=(1,4,
     5:%05,
     14:%06,SFF,TO=ZD,LENGTH=17)


After your suggestion , i modified it as follows

Code:
OPTION COPY
INREC IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C'"',C''))),
IFTHEN=(WHEN=(5,3,CH,NE,C' '),
       PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=11),
       %02=(ENDBEFR=C',',FIXLEN=02),
       %03=(ENDBEFR=C',',FIXLEN=02),
       %04=(ENDBEFR=C',',FIXLEN=02),
       %05=(ENDBEFR=C',',FIXLEN=09),
       %06=(ENDBEFR=C',',FIXLEN=17)),
BUILD=(1,4,
     5:%05,
     14:%06,SFF,TO=ZD,LENGTH=17))


I have a question
a) Is IFTHEN should always be followed by 'WHEN ". In the above control statement i dont want to use "WHEN=(5,3,CH,NE,C' ')," & wanted to just parse the input after double quotes were replaced.
b) Also How do i convert the input file from VB (lrecl=1000 ) to FB (lrecl=80) in this example?.

Thanks in advance for your help.
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: Tue Mar 24, 2009 3:27 am    Post subject:
Reply with quote

Using INREC and OUTREC as you did will work.

Using just INREC, you can use IFTHEN=(WHEN=INIT twice:

Code:

  INREC IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C'"',C''))),
    IFTHEN=(WHEN=INIT,
       PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=11),
       ....


To convert from VB/1000 to FB/80 you can use:

Code:

   OUTFIL VTOF,BUILD=(5,80)
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Tue Mar 24, 2009 8:03 pm    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Dear Frank,

Thanks for your prompt response.

Regards.
Suyerasi
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Mar 25, 2009 8:19 pm    Post subject:
Reply with quote

Hi Frank,

If i code "when=init", in the following control card , the job is failing .

Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C'"',C''))),
  IFTHEN=(WHEN=INIT,                           ===>  Replaced (5,3,CH,NE,C' '),
       PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=11),
       %02=(ENDBEFR=C',',FIXLEN=02),
       %03=(ENDBEFR=C',',FIXLEN=02),
       %04=(ENDBEFR=C',',FIXLEN=02),
       %05=(ENDBEFR=C',',FIXLEN=09),
       %06=(ENDBEFR=C',',FIXLEN=17)),
  BUILD=(1,4,
      5:%01,
     16:%02,
     18:%03,
     20:%04,
     22:%05,
     31:%06,SFF,TO=ZD,LENGTH=17))
  OUTFIL VTOF,BUILD=(5,80)


Below is the error,i got . Could you plz correct me?

Code:
ICE027A 9 END OF SORTOUT  FIELD BEYOND MAXIMUM RECORD LENGTH
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 Mar 25, 2009 10:31 pm    Post subject:
Reply with quote

The second WHEN=INIT clause in your INREC statement creates a reformatted record with a length of 47 bytes, but your OUTFIL statement is trying to use bytes beyond that (80 > 47). 5,80 for OUTFIL requires an 84 byte INREC record. Thus, you get the ICE027A message. You need to create an 84 byte record with INREC.

You can change your last INREC BUILD line to:

Code:

      31:%06,SFF,TO=ZD,LENGTH=17,84:X))   
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Thu Mar 26, 2009 1:51 am    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Hi Frank,

It worked fine after i made the change.

Thanks
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Apr 01, 2009 2:55 am    Post subject:
Reply with quote

Hi Frank,

In the example given below , i would like to suppress leading zeroes for the field#5 and the data type is character. Could you plz give the solution for this?

Code:

OPTION COPY
INREC IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C'"',C''))),
IFTHEN=(WHEN=(5,3,CH,NE,C' '),
       PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=11),
       %02=(ENDBEFR=C',',FIXLEN=02),
       %03=(ENDBEFR=C',',FIXLEN=02),
       %04=(ENDBEFR=C',',FIXLEN=02),
       %05=(ENDBEFR=C',',FIXLEN=09),
       %06=(ENDBEFR=C',',FIXLEN=17)),
BUILD=(1,4,
     5:%05,
     14:%06,SFF,TO=ZD,LENGTH=17))
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 Apr 01, 2009 3:07 am    Post subject:
Reply with quote

Please show an example of the records in your input file and what you expect for output.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Apr 01, 2009 3:32 am    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Hi Frank,

Please find below the input
Code:

"03/27/2009","","","","000123456",3.673050000
"03/27/2009","","","","000000006",3.673050000
"03/27/2009","","","","000000456",3.673050000


Expected output
Code:

03/27/2009bbbbbb   1234563.673050000
03/27/2009bbbbbb        63.673050000
03/27/2009bbbbbb      4563.673050000
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 Apr 01, 2009 4:06 am    Post subject:
Reply with quote

Your expected output doesn't match your control statements, so I'm not sure if you're asking me for the complete control statements to go from your input to your output, or just how to edit the %05 field.

You could use something like this to edit the %05 field:

Code:

    5:%05,UFF,M10,LENGTH=n,


where n is the length you want for the field.
Back to top
View user's profile Send private message
suyerasi

New User


Joined: 05 Apr 2007
Posts: 38
Location: india

PostPosted: Wed Apr 01, 2009 7:50 pm    Post subject: Reply to: Findrep & Parse to format the file
Reply with quote

Frank,

It worked fine . I was trying to supress the leading zeroes while formatting the input. Thanks for the solution

Regards
Suyerasi
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 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
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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