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 

different length

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


Joined: 03 Mar 2005
Posts: 2
Topics: 1

PostPosted: Thu Mar 03, 2005 7:35 pm    Post subject: different length Reply with quote

Hi.

I have to move one pic s9(8 ) comp with the value that can vary from 108 to 24000, to s9(4) comp.

How I can move + of 9999 for s9(4) comp?

(I cannot modify s9(4) comp)

Thanks.

Rui Simoes
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 04, 2005 10:36 am    Post subject: Reply with quote

ruisim,
Quote:

How I can move + of 9999 for s9(4) comp?




An item defined as S9(1) through S9(4) COMP is stored as binary halfword(2 bytes) which can store values in range of -32768 through +32767

An item defined as S9(5) through S9(9) COMP is stored as binary fullword(4 bytes) which can store values in range of -2,147,483,648 through +2,147,483,647


Programs compiled with TRUNC(STD) will only let you store a max value of 9999 in a 2 byte binary field.

With TRUNC(BIN) Compiler option you can store up to 32767 in a 2 byte binary field.

So all you need is to add the following statement as the first line in your program

Code:

CBL TRUNC(BIN)                           


And check this link for a detailed explanation of the TRUNC compiler option.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.52?DT=20020923143836

Example pgm with TRUNC(BIN)

Code:

CBL TRUNC(BIN)                           
IDENTIFICATION DIVISION.                 
PROGRAM-ID.    SAMPLE                   
ENVIRONMENT DIVISION.                   
DATA DIVISION.                           
WORKING-STORAGE SECTION.                 
01 WS-NUM                PIC S9(04) COMP.
                                         
PROCEDURE DIVISION.                     
     MOVE 32767 TO WS-NUM               
     DISPLAY 'THE NUM  VALUE: ' WS-NUM   
                                         
     GOBACK.                             


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ruisim
Beginner


Joined: 03 Mar 2005
Posts: 2
Topics: 1

PostPosted: Mon Mar 07, 2005 6:43 pm    Post subject: Reply with quote

Thanks, it's working.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
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