Obsidian | Level 7

## negative values to cobol pack values

Hi experts,

I have this value  "-0000180" and i want to transform it into "000018p", where p simbolize the negative value for cobol according to this equivalents:

0=p  1=q  2=r  3=s  4=t  5=u  6=v  7=w  8=x  9=y

i have to sustitute the last digit of the negative value by the corresponding letter and keep the zeroes to the left,  examples:

-000323 = 00032s

-000567 = 00056w

Do you have any idea to do it ?

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: negative values to cobol pack values

Hi @Jose7,

The VMSZNw.d format looks promising:

```50   data _null_;
51   array x[3] (-180 -323 -567);
52   put x1 z8. +1 x1 vmszn7. /
53       x2 z7. +2 x2 vmszn6. /
54       x3 z7. +2 x3 vmszn6.;
55   run;

-0000180 000018p
-000323  00032s
-000567  00056w```
2 REPLIES 2
Meteorite | Level 14

## Re: negative values to cobol pack values

I don't believe you need to do it manually.  Have you looked at the S370 series of formats?  Those are intended to be used for mainframe compatible numeric formats.  I believe S370FPD would be the format you want.

Also, take a look at this link:  https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p17nnhja9pspodn1k6nfdop68xwk.ht...

Jim

## Re: negative values to cobol pack values

Hi @Jose7,

The VMSZNw.d format looks promising:

```50   data _null_;
51   array x[3] (-180 -323 -567);
52   put x1 z8. +1 x1 vmszn7. /
53       x2 z7. +2 x2 vmszn6. /
54       x3 z7. +2 x3 vmszn6.;
55   run;

-0000180 000018p
-000323  00032s
-000567  00056w```
Discussion stats
• 2 replies
• 444 views
• 3 likes
• 3 in conversation