MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Packed Decimal sign bit 'A' issue

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
shreyas_e
Beginner


Joined: 06 Nov 2017
Posts: 10
Topics: 4

PostPosted: Tue Nov 07, 2017 8:47 am    Post subject: Packed Decimal sign bit 'A' issue Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Nov 07, 2017 9:14 am    Post subject: Re: Packed Decimal sign bit 'A' issue Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shreyas_e
Beginner


Joined: 06 Nov 2017
Posts: 10
Topics: 4

PostPosted: Tue Nov 07, 2017 9:59 am    Post subject: Reply with quote

Hi 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'.

I have used the below in DFSORT.
Code:

SORT FIELDS=COPY                   
INREC IFTHEN=(WHEN=(10,3,PD,NE,NUM),
      OVERLAY=(10:X'00000C'))       

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.
Code:

!@#$^  î̪qÎè  è  g_
57755135799753153186
ACBBF2468A8642C4297D

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
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Nov 07, 2017 10:21 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shreyas_e
Beginner


Joined: 06 Nov 2017
Posts: 10
Topics: 4

PostPosted: Tue Nov 07, 2017 10:51 am    Post subject: Reply with quote

Hi Kolusu,

Sorry. I have been trying many tests. May be I did not post the correct information.
Code:

!@#$^  î̪qÎè  è  g_
57755135799753153186
ACBBF2468A8642C4297D

I am using the above test file and the layout is as per below. I have used HEX ON and showed the contents of the file.
Code:

01  INPUT-RECORD.                             
    05  PACK-DATA1   PICTURE S9(7)V9(2) COMP-3.
    05  PACK-DATA2   PICTURE S9(7)V9(2) COMP-3.
    05  PACK-DATA3   PICTURE S9(7)V9(2) COMP-3.
    05  PACK-DATA4   PICTURE S9(7)V9(2) COMP-3.

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.
Code:

SORT FIELDS=COPY                   
INREC IFTHEN=(WHEN=(6,5,PD,NE,NUM),
      OVERLAY=(6:X'000000000C'))   

I expected DFSORT to consider PACK-DATA2 as Numeric. However it is not doing that. I got the below output.
Code:

!@#$^     qÎè  è  g_
57755000009753153186
ACBBF0000C8642C4297D

Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Nov 07, 2017 11:34 am    Post subject: Reply with quote

shreyas_e,

The NUM check in DFSORT checks for the (F, D or C for the sign). so the sign of A is invalid. However you can add a check for it. Try this.

Code:

//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC IFOUTLEN=20,                                         
        IFTHEN=(WHEN=INIT,OVERLAY=(21:10,1,HEX)),           
        IFTHEN=(WHEN=(22,1,CH,NE,C'A',AND,6,5,PD,NE,NUM),   
        OVERLAY=(6:+0,TO=PD))                               
//*                                                         

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shreyas_e
Beginner


Joined: 06 Nov 2017
Posts: 10
Topics: 4

PostPosted: Tue Nov 07, 2017 2:10 pm    Post subject: Reply with quote

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.
Code:

OPTION COPY                                           
INREC IFOUTLEN=20,                                     
      IFTHEN=(WHEN=INIT,OVERLAY=(21:6,5,HEX)),         
      IFTHEN=(WHEN=(30,1,CH,EQ,C'A',AND,6,5,PD,NE,NUM),

Thanks
Prashanth
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Nov 07, 2017 2:47 pm    Post subject: Reply with quote

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,

bonk 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'
Code:

//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC IFOUTLEN=20,                                       
        IFTHEN=(WHEN=INIT,OVERLAY=(21:10,1,HEX)),           
        IFTHEN=(WHEN=(22,1,CH,NE,C'A',AND,6,5,PD,NE,NUM),   
        OVERLAY=(6:+0,TO=PD)),                             
        IFTHEN=(WHEN=(22,1,CH,EQ,C'A'),                     
        OVERLAY=(6:6,5,PD,PD,LENGTH=5))                     
//*                                                         


Btw I have been editing your post to have code tags. It is about time that you start using Code tags. Here is how it is done

https://www.mvsforums.com/helpboards/viewtopic.php?p=19031#19031
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shreyas_e
Beginner


Joined: 06 Nov 2017
Posts: 10
Topics: 4

PostPosted: Tue Nov 07, 2017 3:25 pm    Post subject: Reply with quote

Sorry for the trouble Kolusu. Its working. Thanks for your help
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group