×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can you use IF statement with Dialog Manager and FOCUS language

Can you use IF statement with Dialog Manager and FOCUS language

Can you use IF statement with Dialog Manager and FOCUS language

(OP)
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

RE: Can you use IF statement with Dialog Manager and FOCUS language

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.

RE: Can you use IF statement with Dialog Manager and FOCUS language

(OP)
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

RE: Can you use IF statement with Dialog Manager and FOCUS language

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close