View previous topic :: View next topic
|
Author |
Message |
jackie.jay
New User
Joined: 26 Oct 2012 Posts: 2 Location: India
|
|
|
|
I am Writing a REXX program to accept value from user, then i will change it in to comp3 and will store it in a file.
Difficulties:
1)the input from user is x(1)9(7) bytes, Ex: A1234567.
2)Convert the above data to COMP-3
3)And storing in the File in the following layout PIC S9(04) COMP-3.
I searched hard but i got only conversion of Packed Decimal to Numeric. So can someone help me to address the above problem.
Thanks,
Jay |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you found it one way, can't you just "run it backwards"?
What do you intend to do with the alpha-numeric?
What do you intend doing with the digits other than the four which you are able to store in the definition you have shown? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
jackie.jay
New User
Joined: 26 Oct 2012 Posts: 2 Location: India
|
|
|
|
Hi Enrico,
Command X2C(number) is not working. I am getting the following message,
BEFORE 1234567
BEF LN 8
89 +++ PACK = X2C(TEMP)
Error running SORTRAN, line 89: Incorrect call to routine
***
My Code :
PNS2 will have value 1234567
SIGN = LEFT(PNS2,1)
IF SIGN = "-" THEN DO
SIGN = "D"
PNS2 = SUBSTR(PNS2,2)
END
ELSE ,
IF SIGN = "+" THEN DO
SIGN = "C"
PNS2 = SUBSTR(PNS2,2)
END
ELSE
SIGN = "C"
SIZE = LENG * 2 - 1
TEMP = RIGHT(PNS2,SIZE,"0") || SIGN
PACK = X2C(TEMP)
LEN = LENGTH(PACK)
Can you kindly look into this ?
Thanks,
Jay |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Your code as included it total crap and already bombs out before the statement containing X2C().
SIASD: Use trace ?r or trace ?i to find the error yourself. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the code I posted was tested and worked...
Your code is different...
just telling that Your code does not work and providing misleading info
is just a waste of time for all
no reason for anybody to download Your broken code to do the testing !
but ...
post using the code tags,it is a due courtesy to people helping,
post ALL the code ,
You diagnosis is wrong, Your code should fail on
SIZE = LENG *2 -1
because as everybody can see LENG was nowhere initialized |
|
Back to top |
|
|
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
Hello Enrico!
What is "code tags" ??
Thanks, Ricardo |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Ricardo Viegas wrote: |
Hello Enrico!
What is "code tags" ??
Thanks, Ricardo |
On the reply (both quick and full) screens there is a "Code" button; clicking inserts a code tag at the cursor position. Clicking the "Close Tags" link will then inserts a closing code tag.
Code: |
Coded text looks like this. |
Note that a fixed-pitch font is used and that multiple spaces are preserved instead of being "squeezed out". This preserves alignment, which can be critical in many cases, and helpfull in many more. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
There is also a Preview function (to the left of the Submit).
Start a new topic or a reply to one. Then apply the code tag to some pgm code, jcl and data. Click Preview to see how your post will appear to the forum rather than how it looks in the Reply editor windor.
Then close the window rather than Submit (unless you are posting anyway ). |
|
Back to top |
|
|
|