“HELLO NATURAL WORLD!” … a very old COBOL barnstormer working with N going on 6 weeks. As with all languages, N has its goodies and its bads … no choice in the matter anyway.
The shop I am in doesn’t have very much experience (oops, just remembered I was told there is a South African contractor in another group that stayed on after implementation). Anyway what has saved my butt so far is that I have made an effort to learn the Debugger.
The bugger shows that the INPUT WITH TEXT USING MAP statement sometimes doesn’t HALT the program when it is executed.
MY QUESTION: WHAT IN HECK determines whether this statement HALTS with map display when executed or whether the execution falls through it ???
Thanks for your help, caballeros …
edit: the South African was still around … said that SET CONTROL ‘xx’ statements simulate pressing different keys when the map is displayed …
is the beast you are looking for, it’s description:
"… causes the next logical output screen to be displayed without requiring any user response for processing to continue; that is, after the screen has been displayed, processing will continue immediately without waiting for any user input. "
I see many SET CONTROL statements in the particular program I am working on, especially SET CONTROL ‘K0’ {I am at home so the syntax may be inexact} which I believe sets the key to the ENTR key.
Does SET CONTROL ‘K0’ also cause the map to be ‘bypassed’ ?
Does *PF-Key value change to reflect the SET CONTROL values ?
Is there a TEST to check if a SET CONTROL ‘N’ is pending ? Can this pending command be cancelled ?
Are the effects of SET CONTROL ‘N’ stacked i.e. if two are issued, are the next two maps ‘bypassed’?
Is the effect ‘global’ i.e passed from one module to another CALLNAT’d or FETCH’d or RETURN’d from?
What does SET CONTROL ‘Q’ do ?
And which manual does one find such info in ?
Thus the word “batch” should be left out of the documentation, because SET CONTROL ‘Q’ and SET CONTROL ‘QS’ are often (mostly?) used in online environments. ‘QS’ means that the map is buffered (saved) internally, but not displayed. When the program meets a REINPUT the map is drawn at the time of the reinput. In other words: You can avoid the MAP, but have it shown later if needed.
Just to add to what Henrik said; QS can also be used with other INPUTs, not just REINPUT. For example, with an INPUT NO ERASE (ala Layouts) or with a window and a new INPUT, etc.
WOW! The expertise brought to bear in this forum is very impressive! Thanks!
I tried using the ‘Documentation’ link at the top of this page but received ‘page not found’.
The manuals I have ‘Natural Developers Handbook’ and an old version of Natural 2 Reference Manual were very cursory in explaining terminal commands.
Please help with these questions:
Is there a TEST to check if a SET CONTROL ‘N’ (or ‘Q’) is pending ? Can this pending command be cancelled ?
Are the effects of SET CONTROL ‘N’ stacked i.e. if two are issued, are the next two maps ‘bypassed’?
Is the effect ‘global’ i.e passed from one module to another which was CALLNAT’d or FETCH’d or RETURN’d from?
Does SET CONTROL ‘K0’ (etc) also cause the map to be ‘bypassed’ ?
Does *PF-Key value change to reflect the SET CONTROL values ?
AND HERE IS A STRANGE ONE: A "STACK TOP DATA ’ ’ " statement in a primary program appears to cause the ‘bypass’ of an INPUT MAP statement in a later FETCH’d program TWICE (the fetched program has a SET CONTROL ‘Q’ in its INITS)!!! If the "STACK TOP DATA ’ ’ " statement in the primary program is commented out, the INPUT MAP in the fetched program is ‘bypassed’ only once … :?:
INPUT will display and/or get data at execution time.
Typically, maps are used on-line to provide captions to the user, or to display current values so that the user can change them. If data is available on the STACK when the INPUT is executed, then the data is taken from there; the map is not displayed because user intervention is not required.
In batch mode, you provide data in the input stream. Natural moves the data to the STACK to satisfy the INPUT statements. By default, the maps are displayed to provide an audit trail. You can eliminate them with %Q.
The STACK TOP DATA ’ ’ statement places data on the STACK. The intent is to avoid a map display the next time an INPUT is executed.
You may wish to display a map but not require user intervention - perhaps to display a progress bar. For this, you have SET CONTROL ‘N’.
In any case, you are not bypassing the INPUT. You are deciding whether the map will be displayed and whether the user must respond. The only way to bypass a map is to place it in a conditional statement block (eg IF).
A follow up (posted in wrong forum): if a program has executed a STACK TOP DATA ’ ', will ANY of the input values of the map be changed as a result of the program falling thru an INPUT USING MAP statement?
Does anyone remember how to write a test program to get answers. I find it very useful when I am not sure how something works.
Try the following code:
DEFINE DATA LOCAL
1 #INPUT (A20)
END-DEFINE
*
* STACK TOP DATA 'Stacked Data'
*
* SET CONTROL 'N'
* SET CONTROL 'Q'
*
RESET #INPUT
*
INPUT #INPUT (AD=MILT)
*
DISPLAY #INPUT
*
END
Uncomment out the STACK DATA and SET CONTROL lines and see what happens.
Here’s what I found.
The STACK DATA TOP command by itself causes the INPUT statement to not be displayed and the data is modified in the INPUT statement.
Adding SET CONTROL ‘N’ doesn’t seem to have any effect. The outcome is the same as above.
Swapping SET CONTROL ‘N’ with SET CONTROL ‘Q’ prevents the data from being modified in the INPUT statement.
A question from earlier was overlooked:
SET CONTROL ‘K0’
causes a PF Key to be ‘executed’ - similar to SET CONTROL ‘N’ (“Enter”). Since there is not PF key ‘0’, K0 is an alias for Enter. Other PF Keys can be invoked - eg SET CONTROL ‘K3’ will invoke PF3. Useful for scripting and rarely useful (= maintainable and comprehensible) for anything else!
Only the last SET CONTROL for N, Q, Kx before an INPUT has useful effect. These affect only the next INPUT (REINPUT, INPUT NO ERASE, “MORE”…did I miss any?) prompt.
*PF-KEY remains unchanged with SET CONTROL ‘N’, ‘Q’, ‘QS’ and others. So, to assign/reset this system variable, you use SET CONTROL ‘Knn’ to change its value immediately. Try this:
SET KEY ALL /* it's necessary!
SET CONTROL 'K00' DISPLAY *PF-KEY
SET CONTROL 'K01' DISPLAY *PF-KEY
SET CONTROL 'K02' DISPLAY *PF-KEY
SET CONTROL 'K03' DISPLAY *PF-KEY
SET CONTROL 'K04' DISPLAY *PF-KEY
SET CONTROL 'K05' DISPLAY *PF-KEY
SET CONTROL 'K06' DISPLAY *PF-KEY
SET CONTROL 'K07' DISPLAY *PF-KEY
SET CONTROL 'K08' DISPLAY *PF-KEY
SET CONTROL 'K09' DISPLAY *PF-KEY
END
*PF-Key is global and SET CONTROL is global, too.
@SAG: Why did you not implement *PF-KEY := ‘PFn’ :?: The SET CONTROL above does exactly the same :o