sort card to add zeros to varying alphanumeric field.

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER
longfall
Posts: 1
Joined: Wed Mar 08, 2023 11:45 pm
Skillset: basics
Referer: google

sort card to add zeros to varying alphanumeric field.

Postby longfall » Thu Mar 09, 2023 12:03 am

Hi All,

I am trying to pull data from a file with delimiter (;).
I could achieve this by using-
INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=8),%02=(FIXLEN=10)),
BUILD=(%00,%02)

Input-
X1234567;08/03/2023

Output-
X123456708/03/2023

Now I need to add, preceding zero to the first column, to make it of length 16-
for this I tried using
BUILD=(%00,UFF,M11,LENGTH=16,%02)
But as its alphanumeric filed the first byte is ignored-

Input-
X1234567;08/03/2023
X124123;08/03/2023

Output-
000000000123456708/03/2023
000000000012412308/03/2023

Exptect output-
00000000X123456708/03/2023
000000000X12412308/03/2023

Can someone guide me on this?

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: sort card to add zeros to varying alphanumeric field.

Postby sergeyken » Thu Mar 09, 2023 2:04 am

PLEASE!!!!!!

Learn how to format your messages, to allow other to understand something

longfall wrote:Hi All,

I am trying to pull data from a file with delimiter (;).
I could achieve this by using-

Code: Select all

INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=8),%02=(FIXLEN=10)),
         BUILD=(%00,%02)


Input-

Code: Select all

X1234567;08/03/2023


Output-

Code: Select all

X123456708/03/2023


Now I need to add, preceding zero to the first column, to make it of length 16-
for this I tried using

Code: Select all

        BUILD=(%00,UFF,M11,LENGTH=16,%02)

But as its alphanumeric filed the first byte is ignored-

Input-

Code: Select all

X1234567;08/03/2023
X124123;08/03/2023
 

Output-

Code: Select all

000000000123456708/03/2023
000000000012412308/03/2023
 

Exptect output-

Code: Select all

00000000X123456708/03/2023
000000000X12412308/03/2023


Can someone guide me on this?


You need simple thing, like this

Code: Select all

INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=8),%02=(FIXLEN=10)),
      BUILD=(%00,JFY=(SHIFT=RIGHT,LENGTH=16,LEAD=C'000000000000'),
             %02)
Javas and Pythons come and go, but JCL and SORT stay forever.


  • Similar Topics
    Replies
    Views
    Last post