My requirements is to add a value 'ALL' in the state field.
Existing code:
-PROMPT &&JATE.ENTER 4 DIGIT JOURNAL DATE(0100). -PROMPT &&TDATE.ENTER 6 DIGIT TRANSMIT DATE(990409). -PROMPT &&DST.ENTER 2 DIGIT STATE (OH CA FL).
As per the new requirement, I need to add the code as below
-PROMPT &&DST.ENTER 3 DIGIT STATE (OH CA ALL).
When the end user selects ST equals to ALL then need to make a match on JDATE, TDATE
When the end user NOT selects ST equals to ALL the need to make a match on JDATE, TDATE, ST
I have not been able to figure out exactly can do that? was hoping someone could supply me with some specifics about the code that would be required to accomplish this task.
Best Regards, Poryes
Focus Mainframe 7.3.6This message has been edited. Last edited by: Kerry,
March 03, 2010, 10:15 AM
GinnyJakes
-SET &ST_WHERE=IF &&DST EQ 'ALL' THEN ' ' ELSE 'put your where clause here with appropriate tick marks';
TABLE FILE filename
...
&ST_WHERE.EVAL
WHERE &&JDATE EQ ...
WHERE &&TDATE EQ ...
...
END
Also you can search the forum for EVAL to get other examples.
I apply the same technique as Ginny but instead of using empty quote marks when I don't want a where statement, I use '-*'.
-SET &HSSCO = DECODE &ROUND(1 '-*'
- 2 'WHERE CO EQ ''101'''
- 3 'WHERE CO EQ ''104'''
- 4 'WHERE CO EQ ''106'''
- 5 'WHERE CO EQ ''104'''
- 6 'WHERE CO EQ ''106''');
TABLE FILE FILENAME
PRINT FLD1
FLD2
&HSSCO.EVAL
END
-EXIT
Works everytime!
Glenda
In FOCUS Since 1990 Production 8.2 Windows
March 03, 2010, 12:48 PM
njsden
You can also make use of my all-time favourite FOC_NONE:
-SET &DST_FILTER = IF &&DST EQ 'ALL' THEN FOC_NONE ELSE &&DST;
TABLE FILE filename
...
WHERE JOURNAL_DATE EQ &&JDATE
WHERE TRANSMIT_DATE EQ &&TDATE
WHERE DIGIT_STATE EQ &DST_FILTER
...
END
He's using mainframe FOCUS and I don't know if FOC_NONE is available there which is why I didn't recommend it in the first place. I was lazy and didn't feel like looking it up. Do you know if it is?
FOCUS has a new feature that is the secret to making the ALL option work. A special keyword FOC_NONE has been added to the FOCUS language that if returned to the reporting engine will bybass the parameter and return all values for that field
I hope it indeed relates to Mainframe FOCUS since the article seems to make references to WebFOCUS and FOCUS somewhat interchangeably.
If FOC_NONE won't work, you could try this (using Neftali's example):
-SET &DST_FILTER = IF &&DST EQ 'ALL' THEN '$*' ELSE &&DST;
TABLE FILE filename
...
WHERE JOURNAL_DATE EQ &&JDATE
WHERE TRANSMIT_DATE EQ &&TDATE
WHERE DIGIT_STATE EQ '&DST_FILTER'
...
END
WebFOCUS 7.7.05
March 04, 2010, 06:12 AM
Poryes
Thanks a lot Ginny/Glenda/Neftali/Dan.
I believe, I'm not specific with my qestion.
If end user selects ST equals to 'ALL' then make a MATCH on JDATE and TDATE to modify the table. In other words all ST values that satisfy the match.
When the end user NOT selects ST equals to ALL the need to make a match on JDATE, TDATE, ST to modify the table. please guide how to accomplish this task.
Thanks in advance...
Best Regards, Poryes
Focus Mainframe 7.6.5
March 04, 2010, 07:25 AM
Dan Satchell
I am assuming from your explanation that columns JDATE, TDATE, and ST are all keys. If you want to MODIFY the data in the table, then the easiest method is to produce a HOLD file containing the desired key values and use the HOLD file as input to the MODIFY. Otherwise, if ST is a key and you do not provide the ST values, then you must use NEXT (and probably CASE) logic, which becomes considerably more complicated.
-PROMPT &JDATE.ENTER 4 DIGIT JOURNAL DATE(0100).
-PROMPT &TDATE.ENTER 6 DIGIT TRANSMIT DATE(990409).
-PROMPT &DST.ENTER 3 DIGIT STATE (OH CA FL ALL).
-*
TABLE FILE filename
BY JDATE
BY TDATE
BY ST
WHERE JDATE EQ &JDATE
WHERE TDATE EQ &TDATE
-IF &DST EQ 'ALL' GOTO SKIP_ST ;
WHERE ST EQ '&DST'
-SKIP_ST
ON TABLE HOLD
END
-*
MODIFY FILE filename
FIXFORM FROM HOLD
MATCH JDATE TDATE ST
ON MATCH ...
ON NOMATCH ...
DATA ON HOLD
END
This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
March 17, 2010, 08:42 AM
Poryes
Sorry for my late response Dan.
I have modified the code and ran the focexec, Got the below error.
(FOC538) SU. CENTRAL AND LOCAL USERS HAVE DIFFERENT MASTER DESCRIPTIONS: TRANSACTIONS: TOTAL = 0 ACCEPTED= 0 REJECTED= 0 SEGMENTS: INPUT = 0 UPDATED = 0 DELETED = 0
Regards, PoryesThis message has been edited. Last edited by: Poryes,