T.R | Title | User | Personal Name | Date | Lines |
---|
3602.1 | Nested .IF problem | IOSG::MAURICE | Insufficient hair for flower | Tue Nov 30 1993 08:40 | 64 |
| Hi,
The problem is caused by nested .IF statements that have THEN and ELSE
keywords.
However in your example you can just rip out the ELSE statements - they
were setting OA$STATUS to 1 in a situation where it was guaranteed to
be set to 1 already. I've edited your code to do that, and also added a
line at the top, as follows:
;;VH;;
GET OA$STATUS = 1
\.IF $AAS_TYPE EQS ""
THEN GET OA$DISPLAY = "No item selected"\\GET OA$STATUS = '0'
\IFSTATUS
\.IF $AAS_TYPE EQS "MAIL"
THEN GET OA$DISPLAY='This option does not apply to MAIL messages'
\\GET OA$STATUS = '0'
\IFSTATUS
\TMR SELECT $TMRDOC,OA$_TMR_READ
\GET OA$DISPLAY = "Checking document attributes . . ."
\FORCE
\XOP "~~VERIFY_ROUTING_INFO~~"
\IFSTATUS
\GET #IPKEY = TMR$VARIABLE$:NAME.VALUE:16["APPLICATION"]
TMR$VARIABLE$:NAME.VALUE:16["DOCUMENT_KEY"]
\.IF AAS_INPROCESS.STATUS[#IPKEY] EQS "X"
THEN GET OA$DISPLAY = "That document has been deleted"
\\TMR SELECT ""
\\.IF OA$CURDOC_DELETE EQS "N"
THEN WRITE CHANGE CAB$ %KEY=OA$CURDOC,DELETE="Y"
\\CAB DELETE_DOCUMENT OA$CURDOC
\\WRITE DELETE AAS_INPROCESS %KEY=#IPKEY
\\GET $AAS_DOC = $TMRDOC = ""
\\GET OA$STATUS = '0'
\IFSTATUS
\GET #CKEY = #IPKEY:32 OA$USER
\.IF AAS_COMPLETED.STATUS[#CKEY] EQS "X"
THEN GET OA$DISPLAY = "That document has been deleted"
\\TMR SELECT ""
\\.IF OA$CURDOC_DELETE EQS "N"
THEN WRITE CHANGE CAB$ %KEY=OA$CURDOC,DELETE="Y"
\\CAB DELETE_DOCUMENT OA$CURDOC
\\WRITE DELETE AAS_COMPLETED %KEY=#CKEY
\\GET $AAS_DOC = $TMRDOC = ""
\\GET OA$STATUS = '0'
\IFSTATUS
\DO TMR$CL_DISPLAY_HISTORY
\TMR SELECT ""
There are two important tools to help
you debug Named Data. The first is to interactively type the command
<DEBUG ON
This gets you into the ALL-IN-1 debugger, and when you type VH at the
menu you can follow the Named data logic step by step.
There are also trace options which you can turn on by pressing GOLD %.
Cheers
Stuart
|
3602.2 | What about adding a null ELSE on the inner most IF? | SOADC1::STREMICK | I want an NCC-1701D!! | Tue Nov 30 1993 19:31 | 24 |
| .
.
.
\.IF AAS_INPROCESS.STATUS[#IPKEY] EQS "X"
THEN GET OA$DISPLAY = "That document has been deleted"
\\TMR SELECT ""
\\.IF OA$CURDOC_DELETE EQS "N"
THEN WRITE CHANGE CAB$ %KEY=OA$CURDOC,DELETE="Y"
ELSE GET OA$STATUS = 1 <-- 'Null' Else?
\\CAB DELETE_DOCUMENT OA$CURDOC
\\WRITE DELETE AAS_INPROCESS %KEY=#IPKEY
\\GET $AAS_DOC = $TMRDOC = ""
\\GET OA$STATUS = '0'
ELSE GET OA$STATUS = '1'
\IFSTATUS
.
.
.
------------
I believe the intent is to execute the remainder of the procedure is the first
delete code did not complete successully. Without the ELSE on the outter most
IF, the procedure would terminate is the delete code failed.
|
3602.4 | Try DEBUG, TRACE, or re-write | ROMEOS::LESLIE_DA | Greetings & Solutions | Wed Dec 01 1993 21:52 | 14 |
| I think the guidance you received in .1 is probably the best thing to
do: figure out from a trace (press <Gold> % to set trace options) where
the code is blowing up or use the ALL-IN-1 debugger.
If *I* were troubleshooting this, *I* would try to simplify the code to
perform a bundle of XOPs instead of trying to do it all in a single
named data entry.
If you decide to do the trace, but can't decipher the results, post
your trace file here and I'm sure you'll get some kind soul to help
out.
HTH,
Dan
|
3602.5 | More | IOSG::MAURICE | Insufficient hair for flower | Wed Dec 01 1993 22:07 | 34 |
| Re .3
Nested .IF's of the form
If
then
if
then
else
else
do not work in Named Data. They do work in scripts, so you can change
the Named Data to the 1 line
DO your_script_name
In the script .if .end_if .then and .else can be used, i.e.
.If
.then
.if
.then
.else
.end_if
.else
.end_if
**HOWEVER** FWIW I disagree with your interpretation of what the code is
trying to do. I still think taking the ELSE statements out will
achieve the effect desired by the original coder.
Cheers
Stuart
|
3602.6 | XOPit | BRUMMY::MARTIN::BELL | Martin Bell, NETCC, Birmingham UK | Thu Dec 02 1993 09:09 | 24 |
| I agree with .4, that you should use XOPs to make the code more readable,
and also to avoid possible syntax problems (named data isn't the easiest
thing in the world to read, never mind debug)
Thus you end up with code such as
if $FOO eqs ""
then
xop "~~FOO_MISSING~~"
else
xop "~~FOO_OK~~"
;;~~FOO_MISSING~~;;
get oa$display="Please supply a FOO"
;;~~FOO_OK~~;;
.if $BAR eqs "N" then get $FOO="Fred"\
more stuff\
even more stuff\
and more
|