Add leading zeroes to record



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Add leading zeroes to record

Postby Manjucan » Fri Feb 08, 2019 1:01 pm

Hi all

My input record is like this

123456789 123456 123456789

Is it possible to add 4 leading zeroes to this record using INREC ?

ie I want the record as below

0000123456789 123456 123456789
Manjucan
 
Posts: 3
Joined: Thu Feb 07, 2019 10:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

 

Re: Add leading zeroes to record

Postby Garry F Carroll » Fri Feb 08, 2019 2:54 pm

Yes, assuming an 80 byte FB record:

INREC BUILD=(1:C'0000',1,80)


adjust for your record type/length.

Garry.
Garry F Carroll
 
Posts: 16
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby Manjucan » Fri Feb 08, 2019 3:15 pm

Thanks Garry.

I tried this option but I am getting the below error :

INREC RECORD LENGTH=84
POTENTIALLY INEFFICIENT USE OF INREC
OUTREC RECORD LENGTH=84
SORTOUT HAS INCOMPATIBLE LRECL
Manjucan
 
Posts: 3
Joined: Thu Feb 07, 2019 10:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby Garry F Carroll » Fri Feb 08, 2019 3:18 pm

What is your RECFM and LRECL ? Can you show the job (using the Code tags) ? Code tags are applied using the buttons above the screen where youre typing.

Garry
Garry F Carroll
 
Posts: 16
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby Manjucan » Fri Feb 08, 2019 4:05 pm

Hi Garry

The RECFM is FB and LRECL =80


OPTION COPY
INREC BUILD=(1:C'0000',1,80)
OUTREC IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=01,ENDPOS=13,SHIFT=NO,
INOUT = (C'0000123456789',C'345678912'))),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=01,ENDPOS=13,SHIFT=NO,
INOUT = (C'0000',C'222222222'))),
IFTHEN


[/code]
Manjucan
 
Posts: 3
Joined: Thu Feb 07, 2019 10:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby Garry F Carroll » Fri Feb 08, 2019 4:18 pm

Those are your control cards, not the job - and now have OUTREC, which has nothing to do with your original question. Can you show the error messages you are getting?

Also, the syntax of the OUTREC statements looks wrong - what is INOUT = ? To start with, there should be no spaces and my SORT documentation shows both IN= and OUT= parameters, not a single INOUT= parameter.

In posting your question, you should specify what you expect as output at the end of processing - what I suggested gives exactly what you looked for without OUTREC processing in your original question.

Garry.
Garry F Carroll
 
Posts: 16
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby Garry F Carroll » Fri Feb 08, 2019 4:39 pm

Not to mention that you have multiple WHEN=INIT clauses - which is incorrect.

Garry.
Garry F Carroll
 
Posts: 16
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Add leading zeroes to record

Postby enrico-sorichetti » Fri Feb 08, 2019 5:44 pm

if You can drop the last 4 bytes use

INREC BUILD=(1:C'0000',1,76)
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2823
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 149 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post