View previous topic :: View next topic |
Author |
Message |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Sun Feb 25, 2007 3:09 am Post subject: Compare alphanumeric and numeric fields. |
|
|
Experts,
I have tried and succeeded in comparing an x(12) field with a 9(9) field but failed to do compare a X(12) field from a MAP with a 9(9)V99 field in a batch job.
Please help me.
Thanks.  _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sun Feb 25, 2007 10:43 am Post subject: |
|
|
ranga_subham,
What is the issues here ? Move the 9(9)v99 variable to x(12) and take care of leading zeroes and decimal point if exists any and compare the items.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Feb 27, 2007 1:07 am Post subject: |
|
|
Thanks Kolusu. I will try it and come back...... _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Feb 27, 2007 5:17 am Post subject: I tried this....... |
|
|
Kolusu,
I've written a small program as per your suggestions......
Code: |
****** ***************************** Top of Data ********
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. MOVE02.
000003 ENVIRONMENT DIVISION.
000004 DATA DIVISION.
000005 WORKING-STORAGE SECTION.
000006 01 WS-XX-1 PIC X(12).
000007 01 WS-XX-2 PIC X(12).
000008 01 WS-NM-1 PIC 9(09)V99.
000009 01 WS-NM-2 PIC 9(09).99.
000010 PROCEDURE DIVISION.
000011 MAIN-PARA.
000012 MOVE SPACE TO WS-XX-1.
000013 MOVE ZEROS TO WS-NM-1.
000014 MOVE '123456' TO WS-XX-1.
000015 MOVE 123456 TO WS-NM-1.
000016 DISPLAY 'XX-1 ' WS-XX-1.
000017 DISPLAY 'NM-1 ' WS-NM-1.
000018 MOVE WS-NM-1 TO WS-NM-2.
000019 DISPLAY 'NM-2 ' WS-NM-2.
000020 MOVE WS-NM-1 TO WS-XX-2.
000021 DISPLAY 'XX-2 ' WS-XX-2.
000022 STOP RUN.
****** **************************** Bottom of Data *******
|
But, the compilation returned the following SEVERE error......
Code: |
LineID Message code Message text
20 IGYPA3005-S "WS-NM-1 (NUMERIC NON-INTEGER)" and "WS-XX-2 (ALPHANUMERIC)" did not follow the "MOVE" statement compatibility rules. The statement was discarded.
* Statistics for COBOL program MOVE02:
* Source records = 22
* Data Division statements = 4
* Procedure Division statements = 11
End of compilation 1, program MOVE02, highest severity 12.
Return code 12
|
Please suggest.
TIA. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
blitz2 Beginner

Joined: 23 Jan 2007 Posts: 84 Topics: 14
|
Posted: Tue Feb 27, 2007 5:54 am Post subject: |
|
|
there are 3 threads going on right now on this alphanumeric-numeric thing. Anyway, the Cobol manual link is available on the homepage.. www.mvsforums.com
You'll save a lot of time if you spend just 15 minutes on the Cobol manual. Perhaps the same time that you would spend posting a message over here... Please do post if something from the manuals is not very convincing.
________
XRM |
|
Back to top |
|
 |
|
|