Hi there!
How I can create a subroutine with parameter in a report mode?
Could you give me some code snippets please?
Best Regards,
Alexander
Hi there!
How I can create a subroutine with parameter in a report mode?
Could you give me some code snippets please?
Best Regards,
Alexander
0010 PERFORM SUB âFREDâ
0020 END
> + Subroutine
l âŚ+âŚ1âŚ+âŚ2âŚ+âŚ3âŚ+âŚ4âŚ+âŚ
0010 DEFINE DATA PARAMETER
0020 1 #A (A4)
0030 END-DEFINE
0040 DEFINE SUBROUTINE SUB
0050 DISPLAY #A
0060 RETURN
0070 END
why donât you want to use structured mode ?
Thank you for reply Giles!
This code for the structured mode , right?
P. S. Sorry, Iâm new to Natural.
Thanks in advance!
that code will catalog in reporting mode (it does on the mainframe natural 8 anyway).
You didnât explain why you want to use reporting mode though.
Strictly speaking there are just two modes, Reporting mode and Structured mode.
There are two main areas where they differ. The first is syntax. In Reporting mode all loops end with the word LOOP (or CLOSE LOOP). Also IF clauses with more than one statement require DOâŚDOEND to âdefine the boundsâ of the IF.
In structured mode all loops end with special terms like END-READ, END-FIND, etc. IF clauses require an END-IF, etc.
The second area of difference is data definition. In the original Reporting Mode, variables were always defined at the first physical occurrence. Thus MOVE âQWERTâ TO #A (A10). When Structured Mode was introduced, it contained all the DEFINE DATA clauses like LOCAL, PARAMETER, GLOBAL, etc.
There is also a third mode. I have always called this âMixed Modeâ, although the documentation calls it Structured Data Mode. This is Reporting Mode with the DEFINE DATA clauses.
Mixed (structured data) MODE is a subset of Reporting Mode, not Structured Mode.
Thus, the following is valid Reporting Mode code:
DEFINE DATA LOCAL
1 MYVIEW VIEW OF EMPLOYEES
2 NAME
2 FIRST-NAME
1 #NAME (A20)
END-DEFINE
READ (10) MYVIEW
IF NAME = âSMITHâ
DO
MOVE NAME TO #NAME
::::
DOEND
LOOP
Note, the Report Mode Syntax. For example DO:::DOEND not END-IF. LOOP not END-READ.
Note also the use of a View, which is allowed in Mixed Mode, and, of course, in Structured Mode. Note also the definition of #NAME in the DEFINE DATA clause, not in the first use of #NAME.
There are, of course, other differences between Report and Structured Mode. For example, MOVE INDEXED is allowed in Report (and hence Mixed) Mode, but not in Structured Mode.
Hence Gilesâ code is perfectly valid Mixed Mode (and hence Report Mode) code.
Although Structured Mode is the newer Mode, it is a subset of Report Mode, since the ânew stuffâ (e.g. DEFINE DATA) was incorporated within the Mixed Mode version of Report Mode.
I tend to call Structured Mode the âidiot proofâ version of Natural since statements that could get you in trouble in Report Mode (MOVE INDEXED being a prime example) do not exist in Structured Mode.
There is really no reason to write new Report (or Mixed Mode ) code unless you have an ancient version of Natural which does not have Structured or Mixed Modes.
I have the Natural 6.3 on the board.
All programs which was created by the previous programmer written in the report mode.
I decided to go on the same way.
Thank you so much for help and explanation!
Kind Regards,
Donât propagate his decision. Start using structured mode.
I only use report mode for a quick and dirty to query a file e.g.
READ FILE
DISPLAY FIELD .