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
 

 

Display all the number that have a ?2? in the centre

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

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Thu Feb 02, 2006 12:39 pm    Post subject: Display all the number that have a ?2? in the centre
Reply with quote

I have a field s9(3) comp-3, values are linke 123, 345, 223, 222. I want to display all the number that have a ?2? in the centre. (remember it?s a comp-3 field)
Back to top
View user's profile Send private message

vikasc4

New User


Joined: 11 Dec 2005
Posts: 32

PostPosted: Thu Feb 02, 2006 1:04 pm    Post subject:
Reply with quote

Hi,
First move the comp-3 fields into a numeric field. Then with the help of refrence modification move the centre no. to another field.
Compare it with 2 and if equal then dispaly the no else not.

The code will be:
DATA ....
77 A PIC S9(3) COMP-3.
77 B PIC 9(3).
77 C PIC 9.
PROCEDURE DIVISION.

MOVE A TO B.
MOVE B(2:1) TO C.
IF C = 2
DISPLAY B
ELSE NEXT SENTANCE.


REGARDS
VIKAS
Back to top
View user's profile Send private message
hncs

New User


Joined: 01 Mar 2006
Posts: 11

PostPosted: Mon Mar 06, 2006 2:48 pm    Post subject:
Reply with quote

WORKING-STORAGE SECTION.

01 WS-I PIC 9(02) VALUE ZEROES.
01 A PIC S9(03) COMP-3 VALUE ZEROES.

PROCEDURE DIVISION.

DIVIDE A BY 10 GIVING A.
DIVIDE A BY 10 GIVING A REMAINDER WS-I.

IF WS-I = 2
DISPLAY 'FOUND******'
ELSE
DISPLAY 'NOT FOUND*******'
END-IF
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 Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm


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