Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

@PROC (format 1) - Switch work files

&pagelevel(3)&pagelevel

This format of the @PROC statement causes EDT to switch to another work file. This work file then becomes the current work file.

Operation

Operands

L mode

@PROC

procnr [comment]

procnr

comment

The number of the work file (1..22) that EDT is to switch to.

Any text as a comment.

The work file that is switched to using this statement this work file continues to be the current work file until an @END statement is issued in order to return to the previous current work file or a further @PROC or @SETF(procnr) statement causes a switch to another work file.

When @PROC is used to switch to a work file, EDT remembers the work file it has just left together with its predecessors (nested work files), i.e. the @END statement returns to the exited work file(s). In contrast, if the user changes the work file with @SETF(procnr) then EDT deactivates the nesting of work files before switching to the new work file and any subsequent @END statement always returns to work file 0 (unless the user has already switched to work file 0 with @SETF). The nesting depth is 22. After this, error message EDT4962 is issued.

If the number of the current work file is specified in the @PROC statement then the statement is rejected with the message EDT4909. An active work file cannot be specified as the current work file. If the user attempts to do so, the message EDT4959 is issued.

Example 1

5.     @PRINT
1.0000 AAAA
2.0000 BBBAADAFD
3.0000 AAA
4.0000 CCCCCCCCCCCCCCCCC
5.     @PROC 6
1.     @ @SET #I6 = LENGTH !
2.     @ @SET #L6 = !
3.     @ @DO 10
4.     @ @DO 12
5.     @ @CREATE #S6: LINE ',#S12,' IS ',#S10,' CHARACTERS LONG'
6.     @ @PRINT #S6 N
7.     @END ---------------------------------------------------------- (1)
5.     @PROC 10 ------------------------------------------------------ (2)
1.     @ @SET #S10 = CHAR #I6
2.     @ @ON #S10:2-2: DELETE '0'
3.     @ @IF .TRUE. : @GOTO 2
4.     @END
5.     @PROC 12 ------------------------------------------------------ (3)
1.     @ @SET #S12 = CHAR #L6
2.     @END
5.     @DO 6 !=%,$
LINE    1.0000 IS  4 CHARACTERS LONG
LINE    2.0000 IS  9 CHARACTERS LONG
LINE    3.0000 IS  3 CHARACTERS LONG
LINE    4.0000 IS  17 CHARACTERS LONG
5.
(1)

Processing returns to work file 0. Work file 6 contains 6 EDT statements including a @DO 10 and a @DO 12. However, these two work files do not yet exist. Consequently, entering a @DO 6 at this point would result in an error.

(2)

Work file 10 is set up. It contains an EDT procedure which transfers the value stored in #I6 to #S10 in printable form and deletes any leading zeros.

(3)

Work file 12 is set up. It contains an EDT procedure which transfers the content of the line number variable #I6 to #S12 in printable form.


Example 2

1.     @SET #I4 = 1
1.     @PROC #I4 ----------------------------------------------------- (1)
1.     @4.00
4.00   @ @SET #I4 = #I4 + 1 ------------------------------------------ (2)
4.01   @ @IF #I4 > 4 : @GOTO 8
4.02   @ @PROC #I4
4.03   @ @PROC ------------------------------------------------------- (3)
4.04   @ @GOTO 4
4.05   @8.00
8.00   @ @SET #I4 = #I4 - 1
8.01   @ @END -------------------------------------------------------- (4)
8.02   @ @IF #I4 = 2 : @RETURN
8.03   @ @PROC ------------------------------------------------------- (5)
8.04   @ @GOTO 8
8.05   @END
1.     @DO #I4 ------------------------------------------------------- (6)
<02>
<03>
<04>
<03>
<02>
1.
(1)

It is also possible to switch to a work file by means of an integer variable. The integer variable must be between 1 and 22.

(2)

Executing work file 1 causes processing to switch to work files 1 and 4. The relevant work file number is always passed in #I4.

(3)

@PROC is issued to check which work file is currently being used. Thus if work file #I4 is being executed at this point, the associated #I4 is recorded.

(4)

A single @END is used to ensure that processing returns to the work file located one level higher in all cases.

(5)

After the return to this work file, the work file that is currently being used is checked again. As a result, a descending sequence of work file numbers from 3 to 2 is output.

(6)An integer variable can also be used to call a work file for the first time.