View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
hi,
I want to change a CLIST program provided by IBM, which is named 'ISRBOX' to REXX, but it does not behavior , can you please point out where I was wrong during the conversion?
code is as below:
Code: |
000001 /******************************REXX***********************************/
000002 /* */
000003 /* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003 */
000004 /* */
000005 /* ISRBOX - Draw a box with its upper left corner at the */
000006 /* cursor position */
000007 /* MODIFIED BY JETZHU, 2012.3.31 CHAGNED TO REXX VERSION */
000008 /*********************************************************************/
000009 Address ISPEXEC
000010 "ISREDIT MACRO "
000011 "ISREDIT (ROW,COL) = CURSOR" /* Get cursor position */
000012 SAY 'ROW: ' ROW 'COL: ' COL
000013 "ISPEXEC CONTROL ERRORS RETURN" /* No macro error panel */
000014 /* Draw box over existing */
000015 /* lines */
000016 "ISREDIT LINE &ROW = LINE + < &COL +--------------------+> "
000017 "ISREDIT LINE &(ROW+1) = LINE + < &COL | |> "
000018 "ISREDIT LINE &(ROW+2) = LINE + < &COL | |> "
000019 "ISREDIT LINE &(ROW+3) = LINE + < &COL | |> "
000020 "ISREDIT LINE &(ROW+4) = LINE + < &COL | |> "
000021 "ISREDIT LINE &(ROW+5) = LINE + < &COL +--------------------+>"
000022 IF RC > 0 THEN DO /* If error occurred while */
000023 " SET ZEDSMSG = &STR(INCOMPLETE BOX)" /* overlaying lines */
000024 " SET ZEDLMSG = &STR(NOT ENOUGH LINES/COLUMNS TO DRAW COMPLETE BOX)"
000025 " ISPEXEC SETMSG MSG(ISRZ001)" /* Issue error message */
000026 END
000027 "SET &COL = &COL + 2" /* Position cursor within */
000028 "SET &ROW = &ROW + 1" /* the box */
000029 "ISREDIT CURSOR = (ROW,COL) "
000030 EXIT 0
****** **************************** Bottom of Data **************************** |
I want to have a summary of CLIST and REXX function contrast, where can I find it? thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Thanks, Dick,
It's just at the end of <<REXX user's guide>>,
I did not notice it, sorry......
thanks for your kind help! |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Code: |
000009 Address ISPEXEC
000010 "ISREDIT MACRO "
000011 "ISREDIT (ROW,COL) = CURSOR" /* Get cursor position */ |
I think you should switch your addressing mode:
Code: |
000009 Address ISREDIT
000010 "MACRO "
000011 "(ROW,COL) = CURSOR" /* Get cursor position */ |
|
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
I have modified the above sample source according to REXX grammer,
Code: |
trace i
Address ISPEXEC
"ISREDIT MACRO "
"ISREDIT (ROW,COL) = CURSOR" /* Get cursor position */
"ISPEXEC CONTROL ERRORS RETURN" /* No macro error panel */
/* Draw box over existing */
/* lines */
"ISREDIT LINE " ROW "= LINE + < " COL "+--------------------+> "
ROW = ROW + 1
"ISREDIT LINE " ROW "= LINE + < " COL "+--------------------+> "
ROW = ROW + 1
"ISREDIT LINE " ROW "= LINE + < " COL "| |" ">"
ROW = ROW + 1
"ISREDIT LINE " ROW "= LINE + < " COL "| |> "
ROW = ROW + 1
"ISREDIT LINE " ROW "= LINE + < " COL "| |> "
ROW = ROW + 1
"ISREDIT LINE " ROW "= LINE + < " COL "+--------------------+>"
IF RC > 0 THEN DO /* If error occurred while */
" ZEDSMSG = " 'INCOMPLETE BOX)' /* overlaying lines */
" ZEDLMSG = " 'NOT ENOUGH LINES/COLUMNS TO DRAW COMPLETE BOX'
" ISPEXEC SETMSG MSG(ISRZ001)" /* Issue error message */
END
COL = COL + 2 /* Position cursor within */
ROW = ROW + 1 /* the box */
"ISREDIT CURSOR = (ROW,COL) "
EXIT 0 |
but the result seems quite strange:
Code: |
****** ***************************** Top of Data *****
001200 TEST-# +--------------------+
001300 TEST-# +--------------------+
001400 TEST-#
001500 TEST-#
001600 TEST-#
001700 TEST-# +--------------------+
001800 TEST-#
001900 TEST-#
002000 TEST-#
****** **************************** Bottom of Data *** |
+--------------------+ can be successfully drawn, but strings like "| |"which contain blank cannot be drawn
can you please give me a hint?
thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
could be the single | starts a parse for the concatenation operator ||,
thus does not include it in the 'literal' generated for the LINE command.
try changing the | to a character that you do not use
or change the | to ## (that's two hash/lbs marks.
then after you have done all the LINE commands,
do a change all '##' '|' |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
You have:
It is strange that you did not see something in the trace.
Your syntax is incorrect. I am surprised the other lines gave you something. I believe the plus sign is part of the syntax of the data text.
Use single quote characters around your data:
Code: |
Address ISREDIT
"LINE " ROW "= LINE + < " COL "'+--------------------+'> "
ROW = ROW + 1
"LINE " ROW "= LINE + < " COL "'| |'>"
ROW = ROW + 1 |
|
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
hi, Pedro,
thanks for your information.
after I modified the source according to your sggestions, program worked fine... |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
It is strange that you did not see something in the trace. |
My point was that the trace showed RC=20 for the lines that did not work. You should have noticed it. |
|
Back to top |
|
|
|