View previous topic :: View next topic
|
Author |
Message |
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
Hi,
Lets say I have a variable define din my copybook as
WS-A PIC S9(7).
Can you please suggest me how should I declare it in Easytrieve Macro?
Thanks.
Nancy |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi nancy,
U can use
VARA STARTING-POS 7 N MASK '-9999999'. |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
Hi,
I used MASK '-9999999'
I got compilation error "B025 MASK DOES NOT MATCH FIELD"
I used MASK 'ZZZZZZZ-' and I have a check in my Ezt pgm where I check thsi field is NUMERIC. It failed in this check.
Plz suggest. I tried many things but nothing is workign out fine to me..
NAncy |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello hiiamnancy and welcome to the forums,
If you post the parts of your code that refer to these fields, we may be better able to help.
Is the field to be used in some calculation or is it only to be placed on a report or ? |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
Hi,
Here is the part of code:
DISPLAY 'NANCY-RF-QUANTITY:' CX010-RF-QUANTITY
IF CX010-RF-QUANTITY NOT NUMERIC
DISPLAY 'NANCY1-RF-QUANTITY:' CX010-RF-QUANTITY
WS-ERROR-CODE = '017'
PERFORM LOG-THE-ERROR
END-IF
In Sysout, I'm getting
NANCY-RF-QUANTITY: 1
NANCY1-RF-QUANTITY: 1
If RF-Quantity is 1 then it should not go into the IF condition.
Please suggest me how should I define this field in Ezetrieve Macro. I'm reading this field from a file in which thsi field is defined as PIC S9(7)
In Ezetrieve Macro, I have defined thsi field as
CX010-RF-QUANTITY 149 7 N +
MASK 'ZZZZZZZ-'
Please suggest what should I do?
Thanks.
Nancy |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Either it's numeric or it's not....Let us get to the bottom of this....
Before your code:
Code: |
DISPLAY 'NANCY-RF-QUANTITY:' CX010-RF-QUANTITY
IF CX010-RF-QUANTITY NOT NUMERIC
DISPLAY 'NANCY1-RF-QUANTITY:' CX010-RF-QUANTITY
WS-ERROR-CODE = '017'
PERFORM LOG-THE-ERROR
END-IF |
add the statement:
DISPLAY HEX CX010-RF-QUANTITY
And after the run, look at the output and "cut and paste" it back here..... |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
Hi the value of Hex for Quantity field in Input file is
thsi was there in my input file
Code: |
CHAR 0000000A
ZONE FFFFFFFC
NUMR 00000001
|
Thanks.
Nancy |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
Hi I added the
DISPLAY HEX CXS010-RF-QUANTITY
stmt in my code and I got this output:
Code: |
CHAR 000000A
ZONE FFFFFFC
NUMR 0000001
1...5.. |
NANCY-RF-QUANTITY: 1
NANCY1-RF-QUANTITY: 1
Thanks.
NAncy |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I know this is stretching a bit, but try your test after defining your data as:
Code: |
CX010-RF-QUANTITY 149 7 N 0 +
MASK 'ZZZZZZZ-' |
If it works, I'll let you know what I think it was.... |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
yeah it works fine now....I'm glad...
But why do 0 is req if its not a decimal field.
Thanks a ton to all
Nancy |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Nancy,
Good to hear it is working
Now, when Bill explains the magic. . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The Fine Manual wrote: |
{N}—zoned decimal — the field contains digits 0 through 9 in external decimal form (that is, 0 = X'F0').
If you specify a numeric field with decimal positions (0 to 18), CA-Easytrieve/Plus considers it a signed (quantitative) field. The following rules apply to signed fields:
2. For non-negative, zoned decimal numbers on the left side of an Assignment statement, CA-Easytrieve/Plus sets an F sign. Otherwise, it manipulates the number in packed decimal format.
If you specify a numeric field with no decimal positions, CA-Easytrieve/Plus considers that field unsigned (non-quantitative) and the following rules apply:
2. Both zoned decimal and packed decimal fields follow the same rules. CA-Easytrieve/Plus packs all zoned decimal fields and handles them as packed decimal fields. CA-Easytrieve/Plus uses the actual storage value in the field, but it is your responsibility to maintain a positive sign. An F sign is placed in any unsigned field on the left side of an Assignment statement. |
Your field was signed, your definition was not, thus, it displayed OK, but it had "non-numeric" values for an unsigned data field....
By the way, do you have access to the EZT manuals? |
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
ok....got it....thanks...I'm a beginner in Ezt...
I have access to manuals but I couldn't find easytrieve manuals...
Thanks.
Nancy |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
hiiamanncy
New User
Joined: 18 Sep 2007 Posts: 9 Location: US
|
|
|
|
ok...yes I checked ...Easytrieve manuals are avaialable...
Thanks. |
|
Back to top |
|
|
|