Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

validating 3rd and 4th position character of 10 digits numbe

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rcreddy

New User


Joined: 23 Nov 2007
Posts: 4
Location: hyderabad

PostPosted: Fri Nov 23, 2007 7:14 pm    Post subject: validating 3rd and 4th position character of 10 digits numbe
Reply with quote

Hi,
This is regarding validation of 3rd and 4th position character.

Details:

I need to validate the 10 digits number.
3 and 4th positions should have "ALPHABETIC"

Example:
Number: 07AB123456
so i need to validate 3 and 4 position character.

plz suggest me how can do this.
Back to top
View user's profile Send private message

sameer

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Fri Nov 23, 2007 7:35 pm    Post subject:
Reply with quote

rcreddy,

This will work.

WORKING-STORAGE SECTION.

01 WS-DATA VALUE '07AB123456'.
05 FILLER PIC X(2).
05 FIELD2 PIC X(2).
05 FILLER PIC X(6).

PROCEDURE DIVISION.
MAIN-PARA.
IF FIELD2 IS ALPHABETIC
DISPLAY '3RD & 4TH BYTES ARE ALPHABETIC'
ELSE
DISPLAY 'NOT ALPHABETIC'
END-IF.
STOP RUN.

Thanks,
Sameer
TCS
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Fri Nov 23, 2007 7:38 pm    Post subject:
Reply with quote

rcreddy,

I think your requirement is to validate the PIC X(10) variable in which 3rd and 4th positions should be "ALPHABETIC" and remaining positions should be "NUMERIC". If yes, please check with the following code for your requirement.
Code:
       IDENTIFICATION DIVISION.             
       PROGRAM-ID. A.                       
       DATA DIVISION.                       
       WORKING-STORAGE SECTION.             
       77 WS PIC X(10) VALUE '07AB123456'.   
       PROCEDURE DIVISION.                   
           IF WS(1:2) IS NUMERIC AND         
              WS(5:6) IS NUMERIC AND         
              WS(3:2) IS ALPHABETIC         
             DISPLAY 'OK'                   
           ELSE                             
             DISPLAY 'NOT OK'               
           END-IF                           
           GOBACK.         
Back to top
View user's profile Send private message
rcreddy

New User


Joined: 23 Nov 2007
Posts: 4
Location: hyderabad

PostPosted: Fri Nov 23, 2007 7:42 pm    Post subject: Reply to: validating 3rd and 4th position character of 10 di
Reply with quote

thanks for ur reply..let me try and will come back to u.
Back to top
View user's profile Send private message
rcreddy

New User


Joined: 23 Nov 2007
Posts: 4
Location: hyderabad

PostPosted: Fri Nov 30, 2007 5:30 pm    Post subject: Reply to: validating 3rd and 4th position character of 10 di
Reply with quote

I have tested it ..it is working..
Thanks for ur suggestion.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts Need help in reading and validating a... ABINAYATHULASI COBOL Programming 8 Tue Apr 18, 2017 11:42 am
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us