Posted: Tue Nov 07, 2017 8:47 am Post subject: Packed Decimal sign bit 'A' issue
We have a Master file which has S9(11)V9(2) COMP-3 field, which has Amounts populated.
- For some records this field has Junk values also.
- There are some records which have the amount populated has sign bit as 'A'.
I am writing a program to extract the data from this file. For this field I have a check to see If its Numeric. If its non numeric(for the junk values in the file) I will populate zeros in the output file. However, my program is considering the Amounts with sign bit as 'A' also as non numeric. I am not ale to differentiate between Junk values and Amounts with sign bit as 'A'.
I did some research and see that the sign bit of 'A', 'B' till 'F' are valid when the NUMCLS COBOL installation option is set to ALT. Since my program does not recognize the sign bit 'A' I believe that NUMCLS COBOL installation is PRIM which only recognizes 'C', 'D' and 'F'.
I am not sure how the Amounts with sign bit 'A' entered the Master file. I tried the DFSORT option to check for NUMERIC, it fails the test for the Amounts with 'A' as sign bit.
Could any one suggest any approach with which I can differentiate between Junk values and Amounts with sign bit 'A'. Once option at this point for me is to modify the sign bit to 'C' manually which is a very time consuming option.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Nov 07, 2017 9:14 am Post subject: Re: Packed Decimal sign bit 'A' issue
shreyas_e wrote:
We have a Master file which has S9(11)V9(2) COMP-3 field, which has Amounts populated.
- For some records this field has Junk values also.
- There are some records which have the amount populated has sign bit as 'A'.
I am writing a program to extract the data from this file. For this field I have a check to see If its Numeric. If its non numeric(for the junk values in the file) I will populate zeros in the output file. However, my program is considering the Amounts with sign bit as 'A' also as non numeric. I am not ale to differentiate between Junk values and Amounts with sign bit as 'A'.
I did some research and see that the sign bit of 'A', 'B' till 'F' are valid when the NUMCLS COBOL installation option is set to ALT. Since my program does not recognize the sign bit 'A' I believe that NUMCLS COBOL installation is PRIM which only recognizes 'C', 'D' and 'F'.
What is your NUMPROC option that the program is compiled with. NUMPROC(NOPFD) will consider the A also as a valid sign
shreyas_e wrote:
I am not sure how the Amounts with sign bit 'A' entered the Master file. I tried the DFSORT option to check for NUMERIC, it fails the test for the Amounts with 'A' as sign bit.
Could any one suggest any approach with which I can differentiate between Junk values and Amounts with sign bit 'A'. Once option at this point for me is to modify the sign bit to 'C' manually which is a very time consuming option.
What did you try? Did you use VERIFY or NUM test? DFSORT is quite capable of checking valid numeric packed decimal data and can update it to zero if there is a JUNK value. What is the LRECL and RECFM of the input file? What is the position of the numeric junk data? _________________ Kolusu
www.linkedin.com/in/kolusu
Thanks for your response. I tried using NUMPROC(NOPFD), but it did not work. I think NUMPROC(NOPFD) will work in conjunction with NUMCLS option. NUMPROC(NOPFD) along with NUMCLS(ALT) will support sign bits 'A' to 'F'.
NUMPROC(NOPFD) along with NUMCLS(PRIM) will support sign bits 'C', 'D' and 'F'.
As of now I testing with a sequential file with the below values. Once I know how to proceed with this scenario, I will apply the same to my master file.
- The first 5 bytes is Junk data.
- Second 5 bytes if 123456789A. 'A' is the sign bit
- Third 5 bytes is 987654321C. 'C' is the sign bit.
- Fourth 5 bytes is 543219876D. 'D' is the sign bit.
I want the first 5 bytes of packed data to be considered non-numeric and the second 5 bytes of packed data to be considered numeric in my program. There is no problem with 3rd and 4th 5 bytes of Packed data.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Nov 07, 2017 10:21 am Post subject:
shreyas_e wrote:
I want the first 5 bytes of packed data to be considered non-numeric and the second 5 bytes of packed data to be considered numeric in my program. There is no problem with 3rd and 4th 5 bytes of Packed data.
Thanks
Prashanth
shreyas_e,
S9(11)V9(2) COMP-3 field results in 7 bytes in storage, why are you checking for 3 bytes? Why can't you check the whole 7 bytes?
And whats up with 5 + 5 byte checking? Do you understand how Comp-3 items are stored? _________________ Kolusu
www.linkedin.com/in/kolusu
PACK-DATA1 has Junk values.
PACK-DATA2 has 123456789A. i.e. 'A' is the sign bit.
PACK-DATA3 has 987654321C. i.e. 'C' is the sign bit.
PACK-DATA4 has 543219876D. i.e. 'D' is the sign bit.
I tried the below DFSORT to check whether PACK-DATA2 is Numeric. If not numeric, replace with zeros.
I am trying to use the example DFSORT you have provided. I would like to change the sign from 'A' to 'C'. The second IFTHEN checks for 'A', but I am not sure how to change it to 'C' and write into output file. Could you please help.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Nov 07, 2017 2:47 pm Post subject:
shreyas_e wrote:
Hi Kolusu,
I am trying to use the example DFSORT you have provided. I would like to change the sign from 'A' to 'C'. The second IFTHEN checks for 'A', but I am not sure how to change it to 'C' and write into output file. Could you please help.
Shreyas_e,
How hard is to tell the full requirements at once? You are wasting your time as well as mine. Please don't invent your own logic from what I gave. Use the following control cards which will change the sign to 'C'
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum