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 

Compare alphanumeric and numeric fields.

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


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Sun Feb 25, 2007 3:09 am    Post subject: Compare alphanumeric and numeric fields. Reply with quote

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. Confused Shocked

Please help me.

Thanks. Rolling Eyes
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Feb 25, 2007 10:43 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Feb 27, 2007 1:07 am    Post subject: Reply with quote

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
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Feb 27, 2007 5:17 am    Post subject: I tried this....... Reply with quote

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
View user's profile Send private message
blitz2
Beginner


Joined: 23 Jan 2007
Posts: 84
Topics: 14

PostPosted: Tue Feb 27, 2007 5:54 am    Post subject: Reply with quote

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
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