how to convert packed numbers in a massive scale?



Software AG's platform-independent programming language with full support for open-source and Internet applications

how to convert packed numbers in a massive scale?

Postby raphael » Fri Jul 04, 2014 9:40 am

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!
raphael
 
Posts: 3
Joined: Fri Jul 04, 2014 9:26 am
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert packed numbers in a massive scale?

Postby RGZbrog » Fri Jul 04, 2014 10:32 pm

If you had access to Natural for Windows, all you would need is
DEFINE WORK FILE ## TYPE 'CSV'
Natural 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.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert packed numbers in a massive scale?

Postby raphael » Mon Jul 07, 2014 9:30 am

Great! :D 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.
raphael
 
Posts: 3
Joined: Fri Jul 04, 2014 9:26 am
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert packed numbers in a massive scale?

Postby RGZbrog » Tue Jul 08, 2014 1:24 am

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.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert packed numbers in a massive scale?

Postby raphael » Tue Jul 08, 2014 9:06 am

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!!
raphael
 
Posts: 3
Joined: Fri Jul 04, 2014 9:26 am
Has thanked: 0 time
Been thanked: 0 time


Return to Natural