Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Example: Program for copying files

&pagelevel(4)&pagelevel

A program is to be written to copy ISAM and SAM files. Using the program, it should be possible to change the following:

  • the access method

  • the record length

  • the ISAM key.

The program is to execute as a main program.

If the file to be processed is protected by a password, it should be possible to enter the password without it appearing on the screen. If the password is omitted, it is to be requested in an error dialog.

In addition to the standard SDF statements, the program has the following statement:

COPY-FILE

FROM-FILE = <filename 1..54>

,TO-FILE = <filename 1..54 without-gen-vers>(...)

<filename 1..54 without-gen-vers>(...)

  ACCESS-METHOD = *SAME / *ISAM(...) / *SAM

*ISAM(...)

  KEY-LENGTH = *STD / <integer 1..50>

  ,RECORD-SIZE = *SAME / *VARIABLE / <integer 1..2048>

,PASSWORD = *NONE / <c-string 1..4> / *SECRET-PROMPT

Defining the program in the user syntax file

The program KOP is defined in the user syntax file SDF.KOP.SYNTAX:

/set-logon-parameters sdfusr, ... —————————————————————————————————————  (1)
 .
 .
/start-sdf-a ——————————————————————————————————————————————————————————  (2)
%  BLS0517 MODULE 'SDAMAIN' LOADED
%  SDA0001 'SDF-A' VERSION '04.1E10' STARTED
%//open-syntax-file sdf.kop.syntax,,*create ———————————————————————————  (3)
%//add-program kop ————————————————————————————————————————————————————  (4)
%//add-stmt name=copy-file,prog=kop,intern-name=copyfi,stmt-version=1 —  (5)
%//add-oper from-file,res-oper-name=*pos(1) ———————————————————————————  (6)
%//add-val *filename ——————————————————————————————————————————————————  (7)
%//add-oper to-file,res-oper-name=*pos(2) —————————————————————————————  (8)
%//add-val *filename(gen=*n,vers=*n),structure=*y(siz=*small) —————————  (9)
%//add-oper access-method,default='same',res-oper-name=*pos(3) ———————— (10)

                                                                                       

  1. A task is initiated under the user ID SDFUSR.

  2. SDF-A is loaded and started.

  3. The user syntax file SDF.KOP.SYNTAX is created and opened.

  4. The program KOP is defined. By default, SDF-A takes the first three letters (KOP) as its internal name.

  5. The header of the COPY-FILE statement belonging to the program KOP is defined. Its internal name is COPYFI and it has the version number 1.

  6. The first operand of the COPY-FILE statement is defined. Its name is FROM-FILE. It occupies the first position in the operand array of the transfer area.

  7. It is defined that the value of the FROM-FILE operand must be of the data type FILENAME.

  8. The second operand of the COPY-FILE statement is defined. Its name is TO-FILE. In the operand array of the transfer area it occupies the second position.

  9. It is defined that the value of the TO-FILE operand must be of the data type FILENAME. Specification of a generation number or version number is not permitted. FILENAME introduces a structure.

  10. The first operand in the structure FILENAME is defined. Its name is ACCESS-METHOD. Its default value is SAME. In the operand array of the transfer area it occupies the third position.

    %//add-val *keyw,val='same' ——————————————————————————————————————————— (11)
    %//add-val *keyw,val='isam',struct=*y ————————————————————————————————— (12)
    %//add-oper key-length,default='std',res-oper-name=*pos(4) ———————————— (13)
    %//add-val *keyw,val='std' ———————————————————————————————————————————— (14)
    %//add-val *integer(1,50) ————————————————————————————————————————————— (15)
    %//close-structure ———————————————————————————————————————————————————— (16)
    %//add-val *keyw,val='sam' ———————————————————————————————————————————— (17)
    %//add-oper record-size,default='same',res-oper-name=*pos(5) —————————— (18)
    %//add-val *keyw,val='same' ——————————————————————————————————————————— (19)
    %//add-val *keyw,val='variable' ——————————————————————————————————————— (20)
    %//add-val *integer(1,2048) ——————————————————————————————————————————— (21)
    %//close-struct ——————————————————————————————————————————————————————— (22)

                                                                                           

  11. It is defined that the keyword SAME is a permissible value for the ACCESS-METHOD operand.

  12. It is defined that the keyword ISAM is a permissible value for the ACCESS-METHOD operand. ISAM introduces a structure.

  13. The first operand in the ISAM structure is defined. Its name is KEY-LENGTH. Its default value is STD. In the operand array of the transfer area it occupies the fourth position.

  14. It is defined that the keyword STD is a permissible value for the KEY-LENGTH operand.

  15. It is defined that the value of the KEY-LENGTH operand may be of the data type INTEGER. 1 is defined as its lower limit, 50 as its upper limit.

  16. The structure just edited (ISAM) is closed.

  17. It is defined that the keyword SAM is a permissible value for the ACCESS-METHOD operand.

  18. The second operand in the structure FILENAME is defined. Its name is RECORD-SIZE. Its default value is SAME. In the operand array of the transfer area it occupies the fifth position.

  19. It is defined that the keyword SAME is a permissible value for the RECORD-SIZE operand.

  20. It is defined that the keyword VARIABLE is a permissible value for the RECORD-SIZE operand.

  21. It is defined that the value of the RECORD-SIZE operand may be of the data type INTEGER. 1 is defined as its lower limit, 2048 as its upper limit.

  22. The structure just edited (FILENAME) is closed.

    %//add-oper password,default='none',secret=*y,res-oper-name=*pos(6) ——— (23)
    %//add-val *keyw,val='none' ——————————————————————————————————————————— (24)
    %//add-val *c-string(1,4) ————————————————————————————————————————————— (25)
    %//add-val *keyw,val='secret-prompt',out=*secret —————————————————————— (26)
    %//close-cmd —————————————————————————————————————————————————————————— (27)
    %//show object=*program(name=kop),size=*max ——————————————————————————— (28)
    KOP

    COPY-FILE

       FROM SDF.KOP.SYNTAX (USER)
         FROM-FILE =
              filename 1..54
         TO-FILE =
              filename 1..54_without-generation-version()
              STRUCTURE: filename
                   ACCESS-METHOD = *SAME
                        *SAME or *ISAM() or *SAM
                        STRUCTURE: *ISAM
                             KEY-LENGTH = *STD
                                  *STD or integer_1..50
                   RECORD-SIZE = *SAME
                        *SAME or *VARIABLE or integer_1..2048
         PASSWORD =
              *NONE or c-string_1..4 or *SECRET-PROMPT -DEFAULT-: *NONE

    %//end
     .
     .

    %//exit-job

                                                                                           

  23. The third global operand of the COPY-FILE statement is defined. Its name is PASSWORD. Its default value is NONE. It is defined as a secret operand. In the operand array of the transfer area it occupies the eighth position.

  24. It is defined that the keyword NONE is a permissible value for the PASSWORD operand.

  25. It is defined that the value of the PASSWORD operand may be of the data type C-STRING. 1 is defined as its minimum length, 4 as its maximum length.

  26. It is defined that the keyword SECRET-PROMPT is a permissible value for the PASSWORD operand. It is not passed to the implementation; instead, after it has been entered, SDF requests a value (not displayed) for PASSWORD.

  27. The definition of the COPY-FILE statement is terminated.

  28. The definition of the program KOP, with all of the statements that go with it, is displayed in its most detailed form.

After analyzing the COPY-FILE statement, SDF writes the following information into the transfer area. The entries enclosed in parentheses are written by SDF-A only when ACCESS-METHOD=*ISAM applies.

Byte

Length in
bytes

Description

Value

0 to 7

8

Standard header


8 to 11

4

Length of the transfer area


12 to 19

8

Internal statement name

C'COPYFI'

20 to 23

4

Reserved


24 to 26

3

Version of the statement

C'001'

27 to 35

9

Reserved


36 to 37

2

Number of positions in the operand array

6

38 to 39

2

Reserved


40

41

42

43

44 to 47

1
1
1

1

4

Additional information for FROM-FILE
Type description for FROM-FILE
Global syntax attributes for FROM-FILE (always 0, as
wildcards are not permitted)
Syntax attributes for data type <filename>, if:

  • a catalog ID is specified

  • a user ID is specified

  • a file generation is specified

  • a version is specified

  • the file is temporary

Absolute address of the value of FROM-FILE

B'1... ....'
11
B'.... ....'

B'1... ....'
B'.1.. ....'
B'..1. ....'
B'...1 ....'
B'.... 1...'
aaaa

48
49
50

51

52 to 55

1
1
1

1

4

Additional information for TO-FILE

Type description for TO-FILE

Global syntax attributes for TO-FILE (always 0, as

wildcards are not permitted)

Syntax attributes for data type <filename>, if:

  • a catalog ID is specified
  • a user ID is specified
  • the file is temporary

Absolute address of the value of TO-FILE

B'1... ....'

11

B'.... ....'



B'1... ....'

B'.1.. ....'

B'.... 1...'

aaaa

56

57

58

59

60 to 63

1

1

1

1

4

Additional information for ACCESS-METHOD

Type description for ACCESS-METHOD

Reserved

Reserved

Absolute address of the value of ACCESS-METHOD

B'1... ....'

22



aaaa

64


65

66

67

68 to 71

1


1

1

1

4

Additional information for KEY-LENGTH


Type description for KEY-LENGTH

Reserved

Reserved

Absolute address of the value of KEY-LENGTH

B'0... ....'
or

B'1... ....'

(2 or 22)


(aaaa)

72

73

74

75

76 to 79

1

1

1

1

4

Additional information for RECORD-SIZE

Type description for RECORD-SIZE

Reserved

Reserved

Absolute address of the value of RECORD-SIZE

B'1... ....'

2 or 22



aaaa

80

81

82

83


84 to 87

1

1

1

1


4

Additional information for PASSWORD

Type description for PASSWORD

Reserved

Syntax attributes for data type <c-string>:

  • if the password contains single quotes

Absolute address of the value of PASSWORD

B'1... ....'

2 or 22



B'1... ....'

aaaa


2

2

<= 54

Length specification

Reserved

Value of FROM-FILE

II


xxx


2

2

<= 54

Length specification

Reserved

Value of TO-FILE

II


xxx


2

2

<= 4

Length specification

Reserved

Value of ACCESS-METHOD

II


xxx


(2)

(2)

(<= 4)

(Length specification)

(Reserved)

(Value of KEY-LENGTH)

(II)


(xxx)


2

2

<= 8

Length specification

Reserved

Value of RECORD-SIZE

II


xxx


2

2

<= 4

Length specification

Reserved

Value of PASSWORD

II


xxx

The COPY-FILE statement occupies a maximum of 240 bytes in the transfer area. Consequently, the transfer area must be at least 240 bytes long.

Generating the program

The KOP program is shown below:

KOP      START
         TITLE 'Example of program using SDF macros'
*---------------------------------------------------------------------* 
* The program reads and corrects the statement COPY-FILE with SDF,
* then executes it.
* The field identifiers used by this program are to be found in the 
* SDF macros CMDTA for the transfer area, CMDMEM for the status.
*---------------------------------------------------------------------* 
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11 
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
*---------------------------------------------------------------------* 
FRFILE#  EQU      1                     position of operand FROM-FILE
TOFILE#  EQU      2                                         TO-FILE
ACCESS#  EQU      3                                         ACCESS-METH
KEYLEN#  EQU      4                                         KEY-LENGTH
RECSIZ#  EQU      5                                         RECORD-SIZE
PASSWR#  EQU      6                                         PASSWORD
         CMDANALY ,                     SDF return codes
TAD      CMDTA    MF=D                  SDF transfer area 
RSTD     CMDRST   MF=D                  Read statements
CSTD     CMDCST   MF=D                  Correct statement
*---------------------------------------------------------------------* 
*        Register usage
*        R2       SDF output area for CMDSTA, CMDRST, CMDCST.
*        R3       current character in filename analysis
*        R3       current field in SDF output area
*
*        R5       help register
*        R10,R11  base registers
*        R15      return code
*---------------------------------------------------------------------* 
KOP      CSECT    ,
BEGIN    BALR     R10,R0
         USING    *,R10,R11
         B        F00
SLICE#   DC       F'4096'
F00      LR       R11,R10
         A        R11,SLICE#
*---------------------------------------------------------------------* 
*        Check if user syntax file is activated. 
*---------------------------------------------------------------------* 
         CMDMEM   D,P=XMD               Layout for CMDSTA output
*
KOP      CSECT    ,
*
         CMDSTA   OUTAREA=STA#OUT       Get SDF options
*
         USING    XMDMEM,R2
         LA       R2,STA#OUT
         LA       R3,XMDUSER
         CLI      0(R3),':'                Check catid
         BNE      NOCATID
CATIDL   LA       R3,1(R3)
         CLI      0(R3),':' 
         BNE      CATIDL
         LA       R3,1(R3)
NOCATID  CLI      0(R3),'$'                Check userid 
         BNE      NOUSERID
USERIDL  LA       R3,1(R3)
         CLI      0(R3),'.'
         BNE      USERIDL
         LA       R3,1(R3)
NOUSERID CLC      0(USF#L,R3),USF#NAME     Check user syntax file 
         BNE      FC#ERROR
         DROP     R2
*---------------------------------------------------------------------* 
*        Read SDF statement. 
*---------------------------------------------------------------------* 
READSTMT DS       0Y
         MVI      OWNFLAGS,0
         USING    RSTD,1            from CMDRST
         USING    TAD,R2            from CMDTA
         LA       R1,RSTPL
         LA       R2,OUTPUT
*
         CMDRST   MF=E,PARAM=RSTPL
*
         CLI      CMDRMR1,CMDRSUCCESSFUL  no error, continue...
         BE       F01
         CLI      CMDRMR1,CMDREOF         EOF reached
         BE       FC#EOF
         CLI      CMDRMR1,CMDREND_STMT    //END was read
         BE       FC#END
         B        FC#ERROR              otherwise error...
*---------------------------------------------------------------------* 
*        Evaluate structured-description 
*---------------------------------------------------------------------* 
F01      DS       0H
         CLC      CMDINTN,COPYFILE      is this //COPY-FILE ?
         BNE      FC#ERROR              it can only be //COPY-FILE !
*---------------------------------------------------------------------* 
*        operand FROM-FILE
*---------------------------------------------------------------------* 
         LA       R3,CMDMAIN+(FRFILE#-1)*CMDHEAL   FROM-FILE
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(from-file value)
         MVI      FRFILE,' '
         MVC      FRFILE+1(L'FRFILE-1),FRFILE
         USING    CMDOVAL,R3            value field
         LH       R5,CMDLVAL            value length
         BCTR     R5,R0
         EX       R5,EX#MVC1            mvc with l=R5
         B        F02                   skip ex#mvc1...
EX#MVC1  MVC      FRFILE(1),CMDAVAL
*---------------------------------------------------------------------* 
*        operand PASSWORD
*---------------------------------------------------------------------* 
F02      DS       0H
         LA       R3,CMDMAIN+(PASSWR#-1)*CMDHEAL   PASSWORD
         USING    CMDODES,R3
         CLI      CMDOTYP,CMDCSTR       C-string input ?
         BNE      NO#PASS               no: no password input 
*        copy input password into own field
         MVI      PASSWR,' '
         MVC      PASSWR+1(L'PASSWR-1),PASSWR
         USING    CMDHEAD,R3            operand description
         L        R3,CMDOPTR            A(password value)
         USING    CMDOVAL,R3            value field
         LH       R5,CMDLVAL            value length
         BCTR     R5,R0
         EX       R5,EX#MVC2            mvc with l=R5
         B        FC#OPEN               skip ex#mvc2...
EX#MVC2  MVC      PASSWR(1),CMDAVAL
NO#PASS  DS       0H 
         OI       OWNFLAGS,NOPASS
FC#OPEN  DS       0H
         CLC      PASSWR,QUESTION       is password = '????' 
         BE       PASS#ER               test corstmt part.
*        open of file FROM-FILE
*        ...
*        if error at open of FROM-FILE:
*        B        PASS#ER
*---------------------------------------------------------------------* 
*        operand TO-FILE
*---------------------------------------------------------------------* 
         LA       R3,CMDMAIN+(TOFILE#-1)*CMDHEAL   TO-FILE 
         USING    CMDODES,R3
         TM       CMDGSTA,CMDOCC       operand input ? 
         BZ       FC#ERROR              no: error
         MVI      TOFILE,' '
         MVC      TOFILE+1(L'TOFILE-1),TOFILE
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(to-file value)
         USING    CMDOVAL,R3            value field
         LH       R5,CMDLVAL            value length
         BCTR     R5,R0
         EX       R5,EX#MVC3            mvc with l=R5
         B        F03                   skip ex#mvc3...
EX#MVC3  MVC      TOFILE(1),CMDAVAL
*---------------------------------------------------------------------* 
*        operand ACCESS-METHOD
*---------------------------------------------------------------------* 
F03      DS       0H
         LA       R3,CMDMAIN+(ACCESS#-1)*CMDHEAL   ACCESS-METHOD 
         USING    CMDODES,R3
         TM       CMDGSTA,CMDOCC        operand input ? 
         BZ       FC#ERROR              no: error
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(access-method value)
         USING    CMDOVAL,R3            value field
         LH       R5,CMDLVAL            value length
         CH       R5,THREE              sam?
         BE       I#SAM
         CLI      CMDAVAL,'I'           isam?
         BE       I#SAM
*        access-method = same
         OI       OWNFLAGS,ACCSAME 
         MVI      ACCESS,'X'
         B        F04                   skip sam/isam
*        access-method = sam / isam
I#SAM    DS       0H
         MVC      ACCESS,CMDAVAL        S:sam / I:isam
*---------------------------------------------------------------------* 
*        operand KEY-LENGTH
*---------------------------------------------------------------------* 
F04      DS       0H
         LA       R3,CMDMAIN+(KEYLEN#-1)*CMDHEAL   KEY-LENGTH
         USING    CMDODES,R3
         TM       CMDGSTA,CMDOCC        operand input ? 
         BZ       F05                   no: not isam, next operand.
         CLI      CMDOTYP,CMDINT
         BE       KEYINT
*        key-length = std : keylen := 8
         MVI      KEYLEN,8
         B        F05
*        key-length = <integer_1..50> 
KEYINT   DS       0H
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(key-length value)
         USING    CMDOVAL,R3            value field
         MVC      KEYLEN,CMDAVAL+3
         B        F05
*---------------------------------------------------------------------* 
*        operand RECORD-SIZE
*---------------------------------------------------------------------* 
F05      DS       0H
         LA       R3,CMDMAIN+(RECSIZ#-1)*CMDHEAL   RECORD-SIZE
         USING    CMDODES,R3
         TM       CMDGSTA,CMDOCC        operand input ? 
         BZ       FC#ERROR              no: error 
         CLI      CMDOTYP,CMDINT
         BE       RECINT
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(record-size value)
         USING    CMDOVAL,R3            value field
         LH       R5,CMDLVAL            value length
         CH       R5,FOUR 
         BNE      F051
*        record-size = same
         OI       OWNFLAGS,RECSAME
         B        F06
F051     DS       0H
*        record-size = variable
         OI       OWNFLAGS,RECVAR
         B        F06
*        record-size = <integer_1..2048>
RECINT   DS       0H
         USING    CMDHEAD,R3
         L        R3,CMDOPTR            A(record-size value)
         USING    CMDOVAL,R3            value field
         MVC      RECSIZ,CMDAVAL+2
F06      DS       0H
*---------------------------------------------------------------------* 
*   ...  Copy file ... 
*        Output of copied values for test purpose (even password!)
*---------------------------------------------------------------------* 
         WROUT    MESS1,FC#END
         WROUT    MESS2,FC#END
         TM       OWNFLAGS,NOPASS
         BZ       WMESS3
         WROUT    MESS11,FC#END
         B        WMESS4
WMESS3   DS       0H
         WROUT    MESS3,FC#END
WMESS4   DS       0H
         TM       OWNFLAGS,ACCSAME
         BZ       WMESS5
         WROUT    MESS4,FC#END          access given 
         B        WMESS6
WMESS5   WROUT    MESS5,FC#END          access default
WMESS6   DS       0H
         TM       OWNFLAGS,KEYSTD
         BNZ      WMESS8
         UNPK     BUFF5(5),KEYHW(3)
         TR       BUFF5(4),CONVCHAR-XF0
         MVC      KEYCHAR,BUFF5
         WROUT    MESS6,FC#END
         B        WMESS7
WMESS8   WROUT    MESS8,FC#END
WMESS7   DS       0H
         TM       OWNFLAGS,RECSAME
         BNZ      WMESS9
         TM       OWNFLAGS,RECVAR 
         BNZ      WMESS10
         UNPK     BUFF5(5),RECSIZ(3)
         TR       BUFF5(4),CONVCHAR-XF0
         MVC      RECCHAR,BUFF5
         WROUT    MESS7,FC#END
         B        REPEAT
WMESS9   WROUT    MESS9,FC#END
         B        REPEAT
WMESS10  WROUT    MESS10,FC#END
*
*        R E P E A T   READSTMT
* 
REPEAT   DS       0H
         B        READSTMT
*---------------------------------------------------------------------* 
*        Password handling routine
*---------------------------------------------------------------------* 
PASS#ER  DS       0H
         LA       R3,CMDMAIN+(PASSWR#-1)*CMDHEAL   PASSWORD
         USING    CMDODES,R3
         OI       CMDGSTA,CMDERR        set operand erroneous
         LA       R1,CSTPL
         USING    CSTD,R1
         CMDCST   MF=M,MESSAGE=A(MESSAGE)
CORRSTMT CMDCST   MF=E,PARAM=CSTPL
         CLI      CMDCMR1,CMDCSUCCESSFUL  corstmt successful? 
         BNE      READSTMT                no: new read...
         B        F01                     repeat analysis...
*
*        Game over. 
*
         B        FC#END
*---------------------------------------------------------------------* 
FC#ERROR DS       0H                    error handling routine
*        ...
FC#EOF   DS       0H                    EOF   handling routine
*        ...
*---------------------------------------------------------------------* 
FC#END   TERM
*---------------------------------------------------------------------* 
*        Parameter lists
*---------------------------------------------------------------------* 
RSTPL    CMDRST   MF=L,PROGRAM='KOP',OUTPUT=A(OUTPUT)
CSTPL    CMDCST   MF=L,INOUT=A(OUTPUT),MESSAGE=A(0)
*                                      given at execution
*---------------------------------------------------------------------* 
*        Used constants, variables and buffers
*---------------------------------------------------------------------* 
RC       DS       X                     return code byte 
USF#NAME DC       'SDF.KOP.SYNTAX'      syntax file name 
USF#L    EQU      *-USF#NAME            user syntax file length
COPYFILE DC       'COPYFI  '            //COPY-FILE internal name
QUESTION DC       '????'
THREE    DC       H'3'
FOUR     DC       H'4'
EIGHT    DC       H'8'
CONVCHAR DC       C'0123456789ABCDEF'
XF0      EQU      X'F0'
*        Message for CORSTMT
MESSAGE  DS       0F
         DC       Y(MSGEND-MESSAGE)
         DS       XL2
         DC       C'PLEASE ENTER PASSWORD FOR INPUT FILE'
MSGEND   EQU      *
*---------------------------------------------------------------------* 
*        Output fields for statement operands
*---------------------------------------------------------------------* 
MESS1    DS       0F
         DC       Y(END1-MESS1)
         DS       CL2
         DC       X'40'
         DC       C'FROM-FILE = '
FRFILE   DS       CL52' '               own from-file
END1     EQU      *
MESS2    DS       0F
         DC       Y(END2-MESS2)
         DS       CL2
         DC       X'40'
         DC       C'TO-FILE   = '
TOFILE   DS       CL52' '               own to-file
END2     EQU      *
MESS3    DS       0F
         DC       Y(END3-MESS3)
         DS       CL2
         DC       X'40'
         DC       C'PASSWORD  = '
PASSWR   DS       CL4                   own password
END3     EQU      *
MESS4    DS       0F
         DC       Y(END4-MESS4)
         DS       CL2
         DC       X'40'
         DC       C'ACCESS-METHOD IS SAME'
END4     EQU      *
MESS5    DS       0F
         DC       Y(END5-MESS5)
         DS       CL2
         DC       X'40'
         DC       C'ACCESS-METHOD = '
ACCESS   DS       X                     own access-method: Sam | Isam
END5     EQU      *
MESS6    DS       0F
         DC       Y(END6-MESS6)
         DS       CL2
         DC       X'40'
         DC       C'KEY-LENGTH = '
KEYCHAR  DS       CL4' '                key-length converted into hexa
END6     EQU      *
MESS7    DS       0F
         DC       Y(END7-MESS7)
         DS       CL2
         DC       X'40'
         DC       C'REC-SIZE   = '
RECCHAR  DS       CL4' '                rec-size   converted into hexa
END7     EQU      *
MESS8    DS       0F
         DC       Y(END8-MESS8)
         DS       CL2
         DC       X'40'
         DC       C'KEY-LENGTH IS STD'
END8     EQU      *
MESS9    DS       0F
         DC       Y(END9-MESS9)
         DS       CL2
         DC       X'40'
         DC       C'REC-SIZE IS SAME' 
END9     EQU      *
MESS10   DS       0F
         DC       Y(END10-MESS10)
         DS       CL2
         DC       X'40'
         DC       C'REC-SIZE IS VARIABLE'
END10    EQU      *
MESS11   DS       0F
         DC       Y(END11-MESS11)
         DS       CL2
         DC       X'40'
         DC       C'PASSWORD IS NONE'
END11    EQU      *
KEYHW    DC       H'0'
         ORG      KEYHW
FIL1     DS       X
KEYLEN   DS       AL1                   own key-length 
BUFF5    DS       CL5                   buffer for unpack
RECSIZ   DS       H                     own record-size
OWNFLAGS DS       X                     own flags
ACCSAME  EQU      X'80'                 access-method=same
KEYSTD   EQU      X'40'                 key-length=std
RECSAME  EQU      X'20'                 record-size=same
RECVAR   EQU      X'10'                            =variable
NOPASS   EQU      X'08'                 no password.
*---------------------------------------------------------------------* 
STA#OUT  DS       0F                    CMDSTA output
         ORG      *+XMDMEML             length from CMDMEM
OUTPUT   CMDTA    MF=L,MAXLEN=400       CMDRST output
*---------------------------------------------------------------------* 
         END      KOP 

Compiling, linking and testing the program

The source program KOP shown above is located in the file KOP.SRC. In the following it is compiled, linked and tested.

/set-logon-parameters sdfusr,... ——————————————————————————————————————  

/start-assembh
%  BLS0500 PROGRAM 'ASSEMBH', VERSION '1.2B00' OF '1998-04-24' LOADED
%  BLS0552 COPYRIGHT (C) FUJITSU SIEMENS COMPUTERS GMBH 1990. ALL RIGHTS
RESERVED

%  ASS6010 V01.2B02 OF BS2000 ASSTRAN  READY

(1)


%//compile source=*lib-elem(lib=kop.lib,elem=kop.src),-
%//mod-lib=kop.lib(el=kop),listing=*parameters-


%//(source-print=*with-object-code(print-statements=*accept),-(2)

%//macro-print=*std,min-mes-w=*note,cross-ref=*std,layout=*std,-
%//output=*syslst),macro-lib=($.syslib.sdf.045,$loader.v140.syslib)


%  ASS6011 ASSEMBLY TIME: 4223 MSEC
%  ASS6018 0 FLAGS, 0 PRIVILEGED FLAGS, 0 MNOTES
%  ASS6019 HIGHEST ERROR-WEIGHT: NO ERRORS
%  ASS6006 LISTING GENERATOR TIME: 3166 MSEC
%//end
%  ASS6012 END OF ASSTRAN
/start-binder
%  BND0500 BINDER VERSION 'V02.1A30' STARTED



%//start-llm-creation internal-name=kop ———————————————————————————————   
%//include-module *lib(lib=kop.lib,elem=kop,type=r) ———————————————————   
%//resolve-by-autolink $.syslib.sdf.045
%//resolve-by-autolink $loader.sysoml.bs2000-ga.14.0a
(3)
(4)

  1. A task is initiated under the user ID SDFUSR.

  2. The program must be assembled with ASSEMBH as it contains the new macros CMDTA, CMDCST and CMDRST. The source program with the program segments shown above is located under the name KOP.SRC as a type S member in the library KOP.LIB. The SDF macros are in the macro library $SYSLIB.SDF.048. The generated object module is to be stored in the library KOP.LIB under the member name KOP.

  3. The linkage editor BINDER is instructed to create a link and load module (LLM) with the internal name KOP.

  4. The linkage editor is instructed to read the object module KOP generated in step 2 and include it in the LLM.

    %//save-llm lib=kop.lib,elem=kop ——————————————————————————————————————  (5)
    %  BND1501 LLM FORMAT: '1'
    %//end
    %  BND1101 BINDER NORMALLY TERMINATED. SEVERITY CLASS: 'OK'
    /mod-sdf-options synt-file=*add(sdf.kop.syntax) ———————————————————————  (6)
    /start-exe *lib-elem(lib=kop.lib,elem=kop) ————————————————————————————  (7)
    %  BLS0524 LLM 'KOP', VERSION ' ' OF '2001-10-10 14:00:22' LOADED
    %  BLS0551 COPYRIGHT (C) FUJITSU SIEMENS COMPUTERS GMBH 2001. ALL RIGHTS
    RESERVED

    %//mod-sdf-opt guid=*n ————————————————————————————————————————————————  (8)
    %STMT:cop-f testdat.sv,pass=*secr —————————————————————————————————————  (9)
    %ENTER SECRET OPERAND (PASSWORD):......

    %  CMD0051 INVALID OPERAND 'TO-FILE'
    %  CMD0099 MANDATORY OPERAND INVALID OR MISSING
    %ENTER OPERANDS:

    to-f=testdat.cop.1(isam,50)

    %STMT:cop-f testdat.if,testdat.cop.2(acc-m=?) ————————————————————————— (10)
    % CMD0090 EXPLANATION OF THE OPERAND ' TO-FILE=TESTDAT.COP.2:ACCESS-METHOD ':

    %SAME or ISAM() or SAM -DEFAULT-: SAME

    %ENTER OPERANDS:

    %TESTDAT.SV,TESTDAT.COP.2(ACC-M=?)

    acc-m=sam

    %  CMD0051 INVALID OPERAND 'PASSWORD'
    % PLEASE ENTER PASSWORD FOR INPUT FILE

    %ENTER SECRET OPERAND (PASSWORD):......

                                                                                           

  5. The executable LLM is stored under the name KOP (as a member of type L) in the library KOP.LIB.

  6. The user syntax file SDF.KOP.SYNTAX, in which the statements for the program KOP are defined, is activated.

  7. The program KOP is started.The command used here, START-EXECUTABLE-PROGRAM, is available in BLSSERV V2.3 and higher (the START-PROGRAM command with RUN-MODE=*ADVANCED is to be used if necessary).

  8. User guidance is set to NO.

  9. Case 1: The COPY-FILE statement is entered without the mandatory operand TO-FILE. Input of the password is to be blanked. SDF requests input of the password and the missing operand.

  10. Case 2: The COPY-FILE statement is entered without the required password. Further information on the ACCESS-METHOD operand is requested. SDF provides the information and requests entry of the password.

    %STMT:cop-f testdat.iv,testdat.cop.3(?) ——————————————————————————————— (11)

  11. Case 3: The COPY-FILE statement is entered without the required password. Further information on the structure that introduces the file name of the output file is requested via the question mark. This causes a switch to temporarily guided dialog. SDF displays the desired information in the operand form and then requests the required password.

    %STMT:? ——————————————————————————————————————————————————————————————— (12)


    ** NORMAL PROGRAM END **
    %CMD:exit-job

  12. The question mark indicates the switch to temporarily guided dialog. SDF displays a menu listing the available statements. These include the standard statements. The STEP statement is not available in interactive mode. Entering the digit 2 selects the END statement and thus terminates the program.