Add leading zeroes to record

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER
Manjucan
Posts: 9
Joined: Thu Feb 07, 2019 10:09 pm
Skillset: Jcl
Cobol
Db2
Referer: Friends

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

Garry F Carroll
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Skillset: CICS, HLASM, DFSORT, REXX, PL/1
Referer: Self-referred

Re: Add leading zeroes to record

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

Yes, assuming an 80 byte FB record:

Code: Select all

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


adjust for your record type/length.

Garry.

Manjucan
Posts: 9
Joined: Thu Feb 07, 2019 10:09 pm
Skillset: Jcl
Cobol
Db2
Referer: Friends

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

Garry F Carroll
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Skillset: CICS, HLASM, DFSORT, REXX, PL/1
Referer: Self-referred

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

Manjucan
Posts: 9
Joined: Thu Feb 07, 2019 10:09 pm
Skillset: Jcl
Cobol
Db2
Referer: Friends

Re: Add leading zeroes to record

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

Hi Garry

The RECFM is FB and LRECL =80

Code: Select all


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]

Garry F Carroll
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Skillset: CICS, HLASM, DFSORT, REXX, PL/1
Referer: Self-referred

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: 28
Joined: Wed Sep 19, 2018 8:20 pm
Skillset: CICS, HLASM, DFSORT, REXX, PL/1
Referer: Self-referred

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.

enrico-sorichetti
Global moderator
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
Referer: www.ibmmainframes.com

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

Code: Select all

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


  • Similar Topics
    Replies
    Views
    Last post