View previous topic :: View next topic
|
Author |
Message |
khyati kumar
New User
Joined: 04 Jan 2008 Posts: 15 Location: Pune
|
|
|
|
How to redefine comp-3 variable?
Suppose I have comp-3 valiable S9(11)V99 comp-3 and I have to move this value to ZZZ,ZZZ,ZZZ,ZZ9.99.So please let me know any suggestion what to do because while moving this variable i am getting S0c7 so i want to redefine ? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
If you are getting a SOC7, that means you have non-numerics in your comp-3 variable. What you need to do is insure that you have valid data. |
|
Back to top |
|
|
khyati kumar
New User
Joined: 04 Jan 2008 Posts: 15 Location: Pune
|
|
|
|
Actually if there is any invalid data in the comp-3 variable i want to display that variable in the control report so i am moving that variable to ZZZ,ZZZ,ZZZ,ZZ9.99.Please tell me the solution so that i can display the invalid value present in the comp-3 variable? |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
To check for invalid packed decimal fields:
1.Use file aid and in format option mode, give the following :
NV 0
or
2. Use SORT with the below sort card:
include cond=(start position,length,PD,EQ,NUM)
This card will include only those records that have valid values in the packed numeric field indicated by the start position and length.
Thanks,
Ajay |
|
Back to top |
|
|
khyati kumar
New User
Joined: 04 Jan 2008 Posts: 15 Location: Pune
|
|
|
|
Actually i want to write this non numeric field present in comp-3 working storage to a report file so if i am sorting it i will lose these variable.Can you please me the solution for this? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
include cond=(start position,length,PD,NE,NUM) |
|
Back to top |
|
|
khyati kumar
New User
Joined: 04 Jan 2008 Posts: 15 Location: Pune
|
|
|
|
Thanks a Lot for your suggestion |
|
Back to top |
|
|
Amit Banerjee
New User
Joined: 12 Jan 2008 Posts: 14 Location: india
|
|
|
|
In the cobol program check if the value is numeric by having
IF <variable-name> IS NUMERIC
ELSE
display in your report. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Amit Banerjee wrote: |
In the cobol program check if the value is numeric by having
IF <variable-name> IS NUMERIC
ELSE
display in your report. |
Thats a sure way to get an 0C7. |
|
Back to top |
|
|
Amit Banerjee
New User
Joined: 12 Jan 2008 Posts: 14 Location: india
|
|
|
|
oh yes..we can't directly check an alphanumeric field for NUMERIC but I guess the packed data can be moved to a variable
VAR-1 PIC 9(11)V9(02)
VAR-2 REDEFINES VAR-1
05 VAR3 PIC X(13)
and then IF VAR-3 IS NUMERIC |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Amit Banerjee wrote: |
oh yes..we can't directly check an alphanumeric field for NUMERIC but I guess the packed data can be moved to a variable
VAR-1 PIC 9(11)V9(02)
VAR-2 REDEFINES VAR-1
05 VAR3 PIC X(13)
and then IF VAR-3 IS NUMERIC |
var-1 is comp-3 so to redefine it var3 would be x(7) not x(13). |
|
Back to top |
|
|
|