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
 

 

Wrong display of comp-3 variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Feb 25, 2008 4:57 pm    Post subject: Wrong display of comp-3 variable
Reply with quote

I have converted the comp-3 data into displayable format. Its working fine in most of the cases but in some cases it is displaying the value wrong

Ex: if the data is 78787 , it is displaying as 7c7c7

According to my observation it is displaying C for 8 and D for 9 icon_sad.gif
Suggest me on how to correct the problem

with regards,
surya
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Feb 25, 2008 5:33 pm    Post subject:
Reply with quote

Post your code to let us see exactly what you are doing.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 9:19 am    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

The code for conversion from comp-3 to displayable format is as follows:

data=c2x(input)
sign=right(data,1)
datas=substr(data,1,length(datas)-1)
if sign = 'D' then
number = '-' || datas

This is what iam doing......
It is working well for most of the inputs except for some of then as i have told in the previous post

with regards,
surya
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue Feb 26, 2008 1:24 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

a snippet with full data checking is here
http://www.ibmmainframes.com/viewtopic.php?t=27921&highlight=unpack
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 1:31 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

Yeah!!! I have checked your post and that is what i have done
i am putting the full code here:

ARG INPUT_DATA LEN DEC
DATAS = C2X(INPUT_DATA)
DATAS = STRIP(DATAS,'T','0')
MAIN = LEN
DTYPE = DATATYPE(DEC)
IF DEC\ = NUM THEN DEC = 0 */
SIGN = RIGHT(DATAS,1)
DATAS = SUBSTR(DATAS,1,LENGTH(DATAS)
DATAM = SUBSTR(DATAS,1,MAIN)
DATAD = SUBSTR(DATAS,(MAIN+1),DEC)
IF DEC\ = 0 THEN
NUMBER = DATAM||'.'||DATAD
ELSE
NUMBER = DATAM
IF SIGN = 'D' THEN
NUMBER='-'||NUMBER
OUTPUT_DATA = NUMBER
RETURN OUTPUT_DATA


But it is not working in some cases as i have mentioned.
It is displaying C for 8 and D for 9

with regards,
surya
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue Feb 26, 2008 2:10 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

Your code is different from my code ..
that' s why it does not work !

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ikj3a320/3.2?SHELF=IKJOSE20&DT=20000113164209#SPTREF23
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 2:14 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

Can you please tell me what is the difference because i didnt find any difference and
one more thing is one of the line is mistyped in my code

it is actually
DATAS = SUBSTR(DATAS,1,LENGTH(DATAS)-1)

i forgot to subtract 1

with regards,
surya
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue Feb 26, 2008 2:26 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

did You look at the link...
review the difference between
Code:
ARG something
and
PARSE ARG something
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 2:35 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

Yeah i have the seen the link....
Actually whatever i have put here is an internal subroutine. I am calling this subroutine whenever i encounter a comp-3 field

So Arg is correct
icon_confused.gif

surya
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue Feb 26, 2008 2:45 pm    Post subject: Reply to: Wrong display of comp-3 variable
Reply with quote

Then it should work, and we have just thrown away some bandwidth icon_cool.gif

Code:

/*REXX- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
Trace "O"

string = "0123456789abcdef"x
chars  = c2x(hex)
say "string" string
say "chars " chars

call ok string
call ko_arg string
call ko_low string
call ko_upp string

exit

ok:  procedure
parse arg string
chars = c2x(string)
say "ok" chars
return 0

ko_arg:  procedure
arg string
chars = c2x(string)
say "ko_arg" chars
return 0

ko_low:  procedure
parse lower  arg string
chars = c2x(string)
say "ko_low" chars
return 0

ko_upp:  procedure
parse upper  arg string
chars = c2x(string)
say "ko_upp" chars
return 0


I never post without testing
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Feb 26, 2008 2:56 pm    Post subject:
Reply with quote

Hey!!! excellent. I got my mistake. i never thought that would be my mistake.

But why is the output changing from arg to parse arg.
can u please throw some light on this

thanks a lot
surya
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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