Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you use IF statement with Dialog Manager and FOCUS language

Status
Not open for further replies.

smcin

Programmer
Mar 26, 2003
2
0
0
US
Hi,
I have created a fex procedure that uses commands from Dialog Manager and focus.

I would like to know if it is possible to pass a variable PERNMB and HEAD1 into a loop. My code is the following:

DEFINE FILE WF0051
CR_AMT/D18.2N=TODAYS_CREDIT_VLM;
DR_AMT/D18.2N=TODAYS_DEBITS_VLM;
BAL_HI/D18.2N=HIGH_BAL_LIMIT_VLM;
BAL_LO/D18.2N=LOW_BAL_LIMIT_VLM;
PERNMB/N2= IF (ACCOUNT_TYPE_VLM EQ 'A' OR 'L' OR 'B') THEN 0 ELSE
IF (ACCOUNT_TYPE_VLM EQ 'I' OR 'E' OR 'V') THEN 01 ELSE '';
HEAD1/A25=IF (ACCOUNT_TYPE_VLM EQ 'A' OR 'L' OR 'B') THEN 'CURRENT YTDA, BALANCE' ELSE
IF (ACCOUNT_TYPE_VLM EQ 'I' OR 'E' OR 'V') THEN 'CURRENT YTDB, BALANCE' ELSE '';
END
-*
-DEFAULT &DATACAT='______'
-*-DEFAULT &DATACATDES='Current Yr'
-SET &YEAR=EDIT(&LYR,'$$$99');
-SET &CURPST=&CP;
-*
TABLE FILE WF0051
PRINT
-* Include standard flexkey field display
-INCLUDE GL3FLD01
CURCD
CURRT
ACCOUNT_TYPE_VLM
CR_AMT AS 'Credit,Amount,Today'
DR_AMT AS 'Debit,Amount,Today'
-* If the account_type_vlm is equal to Assets or Liablities
-* or Balance then we perform include the period zero amount with the
-* YTD total.
-* If the account_type_vlm is equal to Expense, Income or
-* Volume, then we don't include period zero amount with the
-* YTD total.
COMPUTE YTD_TOTAL/P25.2=
-REPEAT PERLOOP FOR &PER FROM PERNMB TO &CURPST STEP 1
-SET &PER=IF &PER LT 10 THEN '0'|&PER ELSE &PER;
-SET &PLUS=IF &PER LT &CURPST THEN ' + ' ELSE ' ';
&YEAR..&DATACAT..&PER &PLUS
-PERLOOP
; AS HEAD1
-*

I would like to be able to pass PERNMB (which will be either a 0 or a 1 ) into this loop.

I receive the following error with this code.

Thanks for your help.
Sheila
 
The problem is that DM and TABLE operate at two different levels within Focus. DM operates at the 'higher' level and can insert values or text into TABLE, MODIFY, etc. code while that code is being built on the FOCSTACK. However, the code being built is not run until something like a -RUN is encountered. Thus, the TABLE, whose code is being built, cannot supply values to DM while it is building the code, and a DEFINE, whose values are retreived by the TABLE, cannot do so either.

Once something like a -RUN is encountered, the TABLE or other code is executed, and DM is 'suspended' until that code completes its processing. After the code is executed, DM activity resumes.

Data can be passed from a TABLE to DM. For example, the TABLE can write to a SAVE file from which DM can retreive data. However, I don't see how that can be done in this case. It looks like you want TABLE and DM to execute simultaneously, and it doesn't work that way.
 
Hi Kiddpete,
Thank you for answering this posting so quickly. I was able to find another way to resolve my issue. We performed the Compute statement and put a 0 to &curpst as one of the statements and then didn't print this field. We then added another calculation that would subtract our ending balance from the YTD_TOTAL if we hit certain conditions. This worked very well for us.
Thank you for explaining how both Dialog Manager and the focus commands work together.

Sheila
 
Part of the issue of passing data from a TABLE to the D.M. is that TABLE may/does produce MULTIPLE records, each with a potentially different value. When you want to insert a value that's produced by TABLE into the D.M., WHICH instance do you want?

That's why KIDDPETE mentioned having your TABLE output got to an extract file (SAVE), and using D.M. -READ statements to read the value back, one record at a time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top