Use a Variable for a File-Name

Is it possible Visual COBOL Personal to use a variable for the 'assign to' name.

I am working on a project that I need to split a file in about 100 different files for delivery. And DO NOT want to create 100 Selects and FD's.

 

Is this possible?

Parents
  • ***********Sorry above Reply Needs some Editing, So I upload it again.






    *********Input Sample COBOL File for Above Program is below. It has File Name as 'READ.CBL'
    ********And User provided That COBOL Source Code File Name(READ.CBL) using Keyboard
    ********Input and the Program accepted that File Name from User during Run Time using
    *******'ACCEPT' clause and MOVEed its Value into COBOL-INPUT-FILE-NAME using 'MOVE' clause.
    *******But here we still should indent Source Code into Area B using 'Tab' Key on keyboard as
    *******shown below.




    123456789===>Column Number
    PROGRAM-ID. READ.
    ENVIRONMENT DIVISION.
    configuration section.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
    1234567890
    SELECT IN-FILE ASSIGN TO 'INPUT.DAT'===> This statement starts at 5 column in Notepad as it should be Area B
    ORGANIZATION IS LINE SEQUENTIAL.


    data division.
    FILE SECTION.
    FD IN-FILE.
    01 IN-RECORD PIC X.
    working-storage section.
    01 READ-RECORD PIC X.

    procedure division.
    OPEN OUTPUT IN-FILE.
    MOVE '*' TO IN-RECORD.
    DISPLAY IN-RECORD.
    WRITE IN-RECORD.
    CLOSE IN-FILE.

    end program READ.




    *****************Numbered Output COBOL Source Code File is below. It has File Name as 'COBOLOUT.CBL'.




    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    000130 FD IN-FILE.
    000140 01 IN-RECORD PIC X.
    000150 working-storage section.
    000160 01 READ-RECORD PIC X.
    000170
    000180 procedure division.
    000190 OPEN OUTPUT IN-FILE.
    000200 MOVE '*' TO IN-RECORD.
    000210 DISPLAY IN-RECORD.
    000220 WRITE IN-RECORD.
    000230 CLOSE IN-FILE.
    000240
    000250 end program READ.








    ********************And Below is Sample Input COBOL Source Code File which should be
    ******************Re-Numbered after Debugging, Editing and Commenting. As we can see,
    ****************Line Number was disrupted.







    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    *******************************(=====> These comments are added at Column position 6 in Source Code)
    ********************
    ******************
    *****************
    ******************
    **********************
    000130 FD IN-FILE.
    000140 01 IN-RECORD PIC X.
    000150 working-storage section.
    000160 01 READ-RECORD PIC X.
    000170
    000180 procedure division.
    000190 OPEN OUTPUT IN-FILE.
    000200 MOVE '*' TO IN-RECORD.
    000210 DISPLAY IN-RECORD.
    000220 WRITE IN-RECORD.
    000230 CLOSE IN-FILE.
    000240
    000250 end program READ.








    ***********And Below is Output COBOL Source Code File which was Re-Numbered.






    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    000130*******************************
    000140********************
    000150******************
    000160*****************
    000170******************
    000180**********************
    000190 FD IN-FILE.
    000200 01 IN-RECORD PIC X.
    000210 working-storage section.
    000220 01 READ-RECORD PIC X.
    000230
    000240 procedure division.
    000250 OPEN OUTPUT IN-FILE.
    000260 MOVE '*' TO IN-RECORD.
    000270 DISPLAY IN-RECORD.
    000280 WRITE IN-RECORD.
    000290 CLOSE IN-FILE.
    000300
    000310 end program READ.
Reply
  • ***********Sorry above Reply Needs some Editing, So I upload it again.






    *********Input Sample COBOL File for Above Program is below. It has File Name as 'READ.CBL'
    ********And User provided That COBOL Source Code File Name(READ.CBL) using Keyboard
    ********Input and the Program accepted that File Name from User during Run Time using
    *******'ACCEPT' clause and MOVEed its Value into COBOL-INPUT-FILE-NAME using 'MOVE' clause.
    *******But here we still should indent Source Code into Area B using 'Tab' Key on keyboard as
    *******shown below.




    123456789===>Column Number
    PROGRAM-ID. READ.
    ENVIRONMENT DIVISION.
    configuration section.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
    1234567890
    SELECT IN-FILE ASSIGN TO 'INPUT.DAT'===> This statement starts at 5 column in Notepad as it should be Area B
    ORGANIZATION IS LINE SEQUENTIAL.


    data division.
    FILE SECTION.
    FD IN-FILE.
    01 IN-RECORD PIC X.
    working-storage section.
    01 READ-RECORD PIC X.

    procedure division.
    OPEN OUTPUT IN-FILE.
    MOVE '*' TO IN-RECORD.
    DISPLAY IN-RECORD.
    WRITE IN-RECORD.
    CLOSE IN-FILE.

    end program READ.




    *****************Numbered Output COBOL Source Code File is below. It has File Name as 'COBOLOUT.CBL'.




    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    000130 FD IN-FILE.
    000140 01 IN-RECORD PIC X.
    000150 working-storage section.
    000160 01 READ-RECORD PIC X.
    000170
    000180 procedure division.
    000190 OPEN OUTPUT IN-FILE.
    000200 MOVE '*' TO IN-RECORD.
    000210 DISPLAY IN-RECORD.
    000220 WRITE IN-RECORD.
    000230 CLOSE IN-FILE.
    000240
    000250 end program READ.








    ********************And Below is Sample Input COBOL Source Code File which should be
    ******************Re-Numbered after Debugging, Editing and Commenting. As we can see,
    ****************Line Number was disrupted.







    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    *******************************(=====> These comments are added at Column position 6 in Source Code)
    ********************
    ******************
    *****************
    ******************
    **********************
    000130 FD IN-FILE.
    000140 01 IN-RECORD PIC X.
    000150 working-storage section.
    000160 01 READ-RECORD PIC X.
    000170
    000180 procedure division.
    000190 OPEN OUTPUT IN-FILE.
    000200 MOVE '*' TO IN-RECORD.
    000210 DISPLAY IN-RECORD.
    000220 WRITE IN-RECORD.
    000230 CLOSE IN-FILE.
    000240
    000250 end program READ.








    ***********And Below is Output COBOL Source Code File which was Re-Numbered.






    000010
    000020 PROGRAM-ID. READ.
    000030 ENVIRONMENT DIVISION.
    000040 configuration section.
    000050 INPUT-OUTPUT SECTION.
    000060 FILE-CONTROL.
    000070 SELECT IN-FILE ASSIGN TO 'INPUT.DAT'
    000080 ORGANIZATION IS LINE SEQUENTIAL.
    000090
    000100
    000110 data division.
    000120 FILE SECTION.
    000130*******************************
    000140********************
    000150******************
    000160*****************
    000170******************
    000180**********************
    000190 FD IN-FILE.
    000200 01 IN-RECORD PIC X.
    000210 working-storage section.
    000220 01 READ-RECORD PIC X.
    000230
    000240 procedure division.
    000250 OPEN OUTPUT IN-FILE.
    000260 MOVE '*' TO IN-RECORD.
    000270 DISPLAY IN-RECORD.
    000280 WRITE IN-RECORD.
    000290 CLOSE IN-FILE.
    000300
    000310 end program READ.
Children
No Data