Is it possible to convert packed number to alphanumeric character without moving them one by one? I need to do this in a massive scale.
I have a generic table with multiple views. Each view has a PACKED NUMBER in different places. I need to put all the data into a work file. If I directly write the packed numbers into a work file, they are displayed as special characters. How do I display them without having to deal with the packed numbers one by one?
Is there such a command that writes the packed numbers into a readable format automatically?
Help please!
how to convert packed numbers in a massive scale?
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: how to convert packed numbers in a massive scale?
If you had access to Natural for Windows, all you would need isNatural unpacks all fields automatically.
I presume that you are on a mainframe, so create a structure that includes the names of all the packed fields, but with format N. This presumes that all packed-field names are unique. Then you can code MOVE BY NAME from the view to the new structure and write the unpacked fields from there.
Code: Select all
DEFINE WORK FILE ## TYPE 'CSV'
I presume that you are on a mainframe, so create a structure that includes the names of all the packed fields, but with format N. This presumes that all packed-field names are unique. Then you can code MOVE BY NAME from the view to the new structure and write the unpacked fields from there.
Re: how to convert packed numbers in a massive scale?
Great!
Thanks very much! The new structure and move by name worked for me. Much easier than what I was doing previously which was using edit masks on each one of them.
Follow up, is there a way to write them numbers into a work file with the decimal point and +/- sign? Im using edit masks for this too.
Thanks again.
Sorry for the questions, Im new at this.

Follow up, is there a way to write them numbers into a work file with the decimal point and +/- sign? Im using edit masks for this too.
Thanks again.
Sorry for the questions, Im new at this.
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: how to convert packed numbers in a massive scale?
Natural presumes that output created with a WRITE WORK statement will be processed by a READ WORK (or the equivalent in some other programming language). That is, the data will be processed by a machine, not a human, so edit masks are extraneous. If you really need them, you must MOVE EDITED to a temporary/alpha field and write that (for each individual field).
If you need your output to be "pretty" consider WRITE instead, and point the output to a file via JCL. You can put an EM parameter on each packed field. There would be no need for MOVE BY NAME or MOVE EDITED statements.
ps I'll admit, there have been times when I would have liked the ability to use EM within a WRITE WORK.
If you need your output to be "pretty" consider WRITE instead, and point the output to a file via JCL. You can put an EM parameter on each packed field. There would be no need for MOVE BY NAME or MOVE EDITED statements.
ps I'll admit, there have been times when I would have liked the ability to use EM within a WRITE WORK.
Re: how to convert packed numbers in a massive scale?
WRITE would have been great, but the lines that Im trying to output goes as long as 2800 record length, thats why I had to resort to WRITE WORK FILE. Edit masks it is then. Thank you very much RGZbrog!!
-
- Similar Topics
- Replies
- Views
- Last post
-
- 4
- 3066
-
by sergeyken
View the latest post
Mon May 22, 2023 12:52 am
-
- 2
- 4125
-
by sergeyken
View the latest post
Tue Aug 02, 2022 4:07 am
-
-
Array processing and Table handling with packed decimal
by rogerstrycova » Tue Oct 26, 2021 3:55 pm » in IBM Cobol - 2
- 1703
-
by Robert Sample
View the latest post
Wed Oct 27, 2021 1:12 am
-
-
- 2
- 8420
-
by prino
View the latest post
Sat Mar 13, 2021 4:47 am
-
- 2
- 1576
-
by sergeyken
View the latest post
Sun Jan 26, 2025 3:07 am