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
 

 

Question Regarding Pic clause.

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

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Wed Nov 14, 2007 3:12 pm    Post subject: Question Regarding Pic clause.
Reply with quote

Can I move an element (having pic comp5 which is just comp) to another element that is comp-3?
Back to top
View user's profile Send private message

muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Nov 14, 2007 3:16 pm    Post subject: Reply to: Question Regarding Pic clause.
Reply with quote

Did you make a try?What was the result?
Back to top
View user's profile Send private message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Wed Nov 14, 2007 3:19 pm    Post subject: Reply to: Question Regarding Pic clause.
Reply with quote

Hi,
I did compile the program successfully but i dont know whether it will work during run time that i cannot check because application can be run by client only.
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Nov 14, 2007 3:43 pm    Post subject: Reply to: Question Regarding Pic clause.
Reply with quote

The move from COMP to COMP-3 is valid provided the variables are of same size.
Please provide the piece of code fordeclaration and move so that we could help you more.
Back to top
View user's profile Send private message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Wed Nov 14, 2007 3:51 pm    Post subject: Reply to: Question Regarding Pic clause.
Reply with quote

01 AT1 PIC S9(00004) COMP.
01 AT2 PIC S9(00012)V9(06) COMP-3 .

Move At1
To At2
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Nov 14, 2007 4:16 pm    Post subject:
Reply with quote

A numeric move works just fine, from four digits to larger works just fine.....
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Nov 14, 2007 7:54 pm    Post subject:
Reply with quote

jackal,
Quote:
Can I move an element (having pic comp5 which is just comp) to another element that is comp-3?

PIC 9(1) COMP-5 can accomodate numeric values from 0 to 65535.
PIC 9(1) COMP-3 can accomodate numeric values from 0 to 9.

suppose if PIC 9(1) COMP-5 contain the value 65535 and is moved to PIC 9(1) COMP-3, the result from PIC 9(1) COMP-3 will be 5 and 6553 will get truncated.

Example code:
Code:
       IDENTIFICATION DIVISION.                             
       PROGRAM-ID. COMP5.                                   
       DATA DIVISION.                                       
       WORKING-STORAGE SECTION.                             
       77 WS-A PIC 9(1) COMP-5 VALUE ZERO.                   
       77 WS-B PIC 9(1) COMP-3 VALUE ZERO.                   
       PROCEDURE DIVISION.                                   
           DISPLAY 'WS-A ' WS-A ' ==> INITIAL  VALUE'       
           DISPLAY 'WS-B ' WS-B '     ==> INITIAL  VALUE'   
           PERFORM 65535 TIMES                               
           COMPUTE WS-A = WS-A + 1                           
           END-PERFORM                                       
           DISPLAY 'WS-A ' WS-A ' ==> COMPUTED VALUE'       
           MOVE WS-A TO WS-B                                 
           DISPLAY 'WS-B ' WS-B '     ==> MOVED    VALUE'   
           GOBACK.                                           

Output:
Code:
WS-A 00000 ==> INITIAL  VALUE
WS-B 0     ==> INITIAL  VALUE
WS-A 65535 ==> COMPUTED VALUE
WS-B 5     ==> MOVED    VALUE

Please post the working-storage declaration for PIC COMP-5 variable. So that it will be easy to suggest you how to declare PIC COMP-3 variable which will get the input value(s) from PIC COMP-5 variable.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Nov 14, 2007 8:56 pm    Post subject:
Reply with quote

jackal,
Quote:
Can I move an element (having pic comp5 which is just comp) to another element that is comp-3?

Quote:
01 AT1 PIC S9(00004) COMP.
01 AT2 PIC S9(00012)V9(06) COMP-3 .

Move At1
To At2


In your first post you mentioned COMP-5 and in the latest post you mentioned as COMP.

Suppose if you are moving COMP-5 to COMP-3, use appropriate PIC 9(x)V9(y) COMP-3.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 14, 2007 10:50 pm    Post subject:
Reply with quote

Hello,

Quote:
I did compile the program successfully but i dont know whether it will work during run time that i cannot check because application can be run by client only.
I suggest you test this (and any other code about which you are unsure) in a test program of your own. This program would have no business-rules logic. It would be only for testing.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Thu Nov 15, 2007 1:29 am    Post subject:
Reply with quote

Jackal,

You said: i cannot check because application can be run by client only.

Ouch... This is not an acceptable situation to be in. Programmers must be able to test their code. This is a basic requirement. I suspect you know this already yet somehow managed to find yourself in a crazy situation that prevents you from testing your code.

Do not stay in this situation. Change the situation so that you can test what you code. If you can't change the situation, then perhaps transfer to an area that does permit their programmers to test their own code...

As well, the question you asked can be answered by making a test program. You don't have to use a production program to test this out. I have hundreds of test programs hanging around that I use to test things out.

But like I said, you need to be able to test your own code.
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 QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts The Last Two Question For You To Ask ... CaptBill Mainframe Interview Questions 0 Fri Apr 14, 2017 5:42 am
No new posts Asynchronous CICS Processing Question moezbud CICS 1 Mon Mar 06, 2017 6:13 pm
No new posts CICS Question RE: Browse, Readnext an... moezbud CICS 7 Sun Mar 05, 2017 5:45 am
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm


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