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

Findrep & Parse to format the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Tue Mar 24, 2009 12:40 am
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
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: 2146
Location: At my coffee table

PostPosted: Tue Mar 24, 2009 1:09 am
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Mar 24, 2009 1:22 am
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Mar 24, 2009 3:27 am
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
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 25, 2009 10:31 pm
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
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Apr 01, 2009 3:07 am
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Apr 01, 2009 4:06 am
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
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 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 Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top