Decision tables: Difference between revisions

m
→‎{{header|REXX}}: added a screen scraping for the possible responses. -- ~~~~
m (→‎{{header|REXX}}: added more comments about what's included herein. -- ~~~~)
m (→‎{{header|REXX}}: added a screen scraping for the possible responses. -- ~~~~)
Line 742:
* a method of allowing the user to quit the interrogation
<lang rexx>/*REXX pgm demonstrates a decision table and possible corrective actions*/
/*REXX pgm demonstrates a decision table and possible corrective actions*/
/*If this is part of a holistic solution, then the first question */
/*that should be asked: Are you having a problem with the printer?*/
Line 767 ⟶ 768:
 
do k=1 while act.k\==''
do j=1; while d=word(act.k,j)\==''; upper d
djm=word(act.k,j)//set; upperif djm==0 then jm=set
if d=='' then leave
if \datatype(d,'U') then iterate
if d\==ans.j jm then iterate k
if j==set then leave
end /*j*/
say pos.k
say pos.k /*display a possible solution. */
possible=possible+1 /*count num of possible solutions*/
end /*k*/
Line 796 ⟶ 799:
return
end /*forever*/</lang>
'''output''' (a screen scraping using a DOS prompt window for the possible responses)
DECISION.REX is the REXX program that produced this output.
<pre style="height:50ex;overflow:scroll">
D:\►rexx decision
 
───────── (question 1 of 3) Does the printer not print?
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
n
───────── (question 3 of 3) Is the printer unrecognized by the software?
n
 
No solutions given for the information supplied.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
n
───────── (question 3 of 3) Is the printer unrecognized by the software?
y
 
Ensure printer software is installed.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
y
───────── (question 3 of 3) Is the printer unrecognized by the software?
n
 
Check/replace ink.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
yes
───────── (question 3 of 3) Is the printer unrecognized by the software?
yes
 
Ensure printer software is installed.
Check/replace ink.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
y
───────── (question 2 of 3) Is there a red light flashing on the printer?
no
───────── (question 3 of 3) Is the printer unrecognized by the software?
no
 
Check for paper jam.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
y
───────── (question 2 of 3) Is there a red light flashing on the printer?
n
───────── (question 3 of 3) Is the printer unrecognized by the software?
y
 
Check the power cable.
check the printer-computer cable.
Ensure printer software is installed.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
y
───────── (question 2 of 3) Is there a red light flashing on the printer?
y
───────── (question 3 of 3) Is the printer unrecognized by the software?
n
 
Check/replace ink.
Check for paper jam.
 
D:\►rexx decision
───────── (question 1 of 3) Does the printer not print?
y
───────── (question 2 of 3) Is there a red light flashing on the printer?
y
───────── (question 3 of 3) Is the printer unrecognized by the software?
y
 
check the printer-computer cable.
Ensure printer software is installed.
Check/replace ink.
 
D:\►
</pre>
 
=={{header|Ruby}}==