Replace spaces in Alphanumeric with zeros

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Replace spaces in Alphanumeric with zeros

Postby djorj » Wed Sep 10, 2008 12:19 pm

Hi All,

I need replace spaces with zeros in alphanumeric fields to asign a numeric filelds. It is posible?

I have PIC X(10) -> ' 123'

I need PIC X(10) -> '0000000123' to asign a PIC 9(10).

The PIC X(10) comes from input file of FAST UNLOAD with OUTPUT-FORMAT E, but on table is a numeric, so i need to use it a numeric.

Or must be formatted with a sort?

Thanks Everyone
Posts: 1
Joined: Wed Sep 10, 2008 11:54 am
Has thanked: 0 time
Been thanked: 0 time

Re: Replace spaces in Alphanumeric with zeros

Postby dick scherrer » Wed Sep 10, 2008 10:00 pm

Hello djorj and welcome to the forums,

In your cobol program you might INSPECT the field replacing spaces with zeros.

If this will not work for your requirement, please clarify.
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Return to IBM Cobol


  • Related topics
    Last post