microfocus
Technical User
O.K., this is the situation. I am extremely new to Cobol (a couple of days). I am trying to learn it on my own. I bought a decent book but I need some guidance. I have to do a program that sorts data (utilizing using/giving) and produces a report.
Purpose: To print a report of all certificate transactions using the P5 override capability by operator ID (sort).
Files: Input: TRANSFILE)
Output: Printfile
Activity: Read sequentially through the transaction file.
If the transaction type= 07 and the cert status =05 or 20
Perform print routine:
USA DEPARTMENT
OFFICE OF PROGRAMS
REPORT OF TRANSACTIONS USING P5 OVERRIDE
DATE: PAGE:
SSN LAST-NAME AREA TYPE EFF-DATE OPID
Else read the next record.
Keep counts of the number of transaction records read
Number of p5’s found
Number of print records written
At the end of file display each count
Close input and output files.
P.S. No input-output procedure (utilize USING and GIVING).
May need TEMP-FILE.
Hello, Can you please look over the first 3 divisions. I am not sure if I need a TEMP-FILE in my select statements. The procedure division is the one that I think I need the most help with. Thank you. The following is what I have so far:
NEXT+ ...1....*....2....*....3....*....4....*....5....*....6....*....7..
152000 CONFIGURATION SECTION.
152100
153000 SOURCE-COMPUTER. B14.
154000 OBJECT-COMPUTER. B14.
155000*
156000 INPUT-OUTPUT SECTION.
157000
158000 FILE-CONTROL.
159300
171000 SELECT TRANSFILE ASSIGN TO DISK.
171400 SELECT SRT-FILE ASSIGN TO SORT DISK.
171440 SELECT TEMP-FILE ASSIGN TO DISK.
171500 SELECT OU1-PRINTFILE ASSIGN TO PRINTER.
172000
173000 I-O-CONTROL.
175000/
176000***************
200000 DATA DIVISION.
201000***************
201100
202000 FILE SECTION.
203000
2204000 SD SRT-FILE
206000 RECORD CONTAINS 44 CHARACTERS
207000 DATA RECORD IS SRT-REC.
208000 01 SRT-REC.
208050 03 SRT-OPID PIC X(3).
208100 03 SRT-SSN PIC 9(9).
208200 03 SRT-LNAM PIC X(20).
209000 03 SRT-AREA PIC X(4).
210000 03 SRT-TYPE PIC X(2).
210700 03 SRT-DATE.
210800 05 SRT-DATE-YY PIC 9(2).
210900 05 SRT-DATE-MM PIC 9(2).
210920 05 SRT-DATE-DD PIC 9(2).
210950
210970*COPY COULD BE FOUND IN THE PRODUCTION LIBRARY FILES
211000 COPY “TRANSFILE.".
211002*
211005 FD TEMP-FILE
211010 RECORD CONTAINS 44 CHARACTERS
211015 DATA RECORD IS TEMP-REC.
211020 01 TEMP-REC.
211021 03 TEMP-OPID PIC X(3).
211022 03 TEMP-SSN PIC 9(9).
211022 03 TEMP-SSN PIC 9(9).
211024 03 TEMP-LNAM PIC X(20).
211025 03 TEMP-AREA PIC X(4).
211030 03 TEMP-TYPE PIC X(2).
211035 03 TEMP-DATE.
211037 05 SRT-DATE-YY PIC 9(2).
211040 05 SRT-DATE-MM PIC 9(2).
211050 05 SRT-DATE-DD PIC 9(2).
211160*
212000 FD OU1-PRINTFILE.
212100 RECORD CONTAINS 132 CHARACTERS
213000 01 OU1-PRINT-REC.
214000 03 FILLER PIC X(132).
220000/
221000*******************
350000 DATA-BASE SECTION.
351000*******************
351100
361000/
362000*************************
400000 WORKING-STORAGE SECTION.
400002*************************
400004 01 SWITCHES.
400010 05 ARE-THERE-MORE-RECORDS PIC XXX VALUE "YES".
400020 05 X PIC 9(2) COMP.
400030 05 UPDATE-SIG PIC 9(1) VALUE 0.
400040*
400050 01 PRINT-FIELDS.
400060
400080 05 PAGE-COUNT PIC S9(3) VALUE ZERO.
400085 05 LINES-ON-PAGE PIC S9(3) VALUE +55.
400090 05 LINE-COUNT PIC S9(3) VALUE +99.
400140 05 SPACE-CONTROL PIC S9.
400190*
400200 01 WS-ITEMS.
400320 03 WS-TRANS-OPID PIC 9(3).
400370 03 CT-TYPE10-FOUND PIC 9(8).
400375 03 CT-TYPE7-FOUND PIC 9(8).
400380 03 CT-OVERRIDE PIC 9(8).
400400
400405*
400410 01 CURRENT-DATE-AND-TIME.
400415 05 CD-YEAR PIC 9999.
400420 05 CD-MONTH PIC 99.
400425 05 CD-DAY PIC 99.
400430 05 CD-HOURS PIC 99.
400435 05 CD-MINUTES PIC 99.
400440 05 FILLER PIC X(9).
400445
400450
401380*
401400 01 HEADING-LINE-1.
401500 05 FILLER PIC X(47) VALUE SPACE.
401600 05 FILLER PIC X(38) VALUE
401700 "USA DEPARTMENT ".
401800 05 PAGE-CNT PIC ZZZ9.
401900 05 FILLER PIC X(47) VALUE SPACE.
402000*
402100 01 HEADING-LINE-2.
402200 05 FILLER PIC X(57) VALUE SPACE.
402210 05 FILLER PIC X(18) VALUE "OFFICE OF TEACHING".
402250 05 FILLER PIC X(57) VALUE SPACE.
402270*
402272 01 HEADING-LINE-3.
402273 05 FILLER PIC X(41) VALUE SPACE.
402274 05 FILLER PIC X(21) VALUE "REPORT OF TRANSACTIONS".
402275 05 FILLER PIC X(29) VALUE "TRANSACTIONS USING OVERRIDE".
402276 05 FILLER PIC X(41) VALUE SPACE.
402278*
402280 01 HEADING-LINE-4.
402282 05 FILLER PIC X(38) VALUE SPACE.
402300 05 FILLER PIC X(7) VALUE "DATE: ".
402320 05 HL1-MONTH PIC 9(2).
402340 05 FILLER PIC X(1) VALUE "/".
402400 05 HL1-DAY PIC 9(2).
402500 05 FILLER PIC X(1) VALUE "/".
402600 05 HL1-YEAR PIC 9(4).
402700 05 FILLER PIC X(28) VALUE SPACE.
402800 05 FILLER PIC X(8) VALUE "PAGE: ".
402900 05 HL1-PAGE-NUMBER PIC ZZZ9.
403000 05 FILLER PIC X(41) VALUE SPACE.
403100*
403200 01 HEADING-LINE-5.
403250 05 FILLER PIC X(37) VALUE SPACE.
403300 05 FILLER PIC X(13) VALUE "SSN ".
403400 05 FILLER PIC X(22) VALUE "LAST NAME ".
403500 05 FILLER PIC X(6) VALUE "AREA ".
403600 05 FILLER PIC X(12) VALUE "EFF-DATE ".
403700 05 FILLER PIC X(5) VALUE "OPID ".
403800 05 FILLER PIC X(37) VALUE SPACE.
403900*
403910 01 DETAIL-LINE.
403920 05 FILLER PIC X(37) VALUE SPACE.
403930 05 DL-SSN PIC 9(9).
403940 05 FILLER PIC X(4) VALUE SPACE.
403950 05 DL-LNAME PIC X(20).
403960 05 FILLER PIC X(2) VALUE SPACE.
403970 05 DL-AREA PIC 9(4).
403980 05 FILLER PIC X(2) VALUE SPACE.
404000 05 DL-EFF-DATE PIC 9(8).
404020 05 FILLER PIC X(4) VALUE SPACE.
404040 05 DL-OPID PIC 9(3).
404060 05 FILLER PIC X(31) VALUE SPACE.
404080/
404100********************
600000 PROCEDURE DIVISION.
600100********************
Purpose: To print a report of all certificate transactions using the P5 override capability by operator ID (sort).
Files: Input: TRANSFILE)
Output: Printfile
Activity: Read sequentially through the transaction file.
If the transaction type= 07 and the cert status =05 or 20
Perform print routine:
USA DEPARTMENT
OFFICE OF PROGRAMS
REPORT OF TRANSACTIONS USING P5 OVERRIDE
DATE: PAGE:
SSN LAST-NAME AREA TYPE EFF-DATE OPID
Else read the next record.
Keep counts of the number of transaction records read
Number of p5’s found
Number of print records written
At the end of file display each count
Close input and output files.
P.S. No input-output procedure (utilize USING and GIVING).
May need TEMP-FILE.
Hello, Can you please look over the first 3 divisions. I am not sure if I need a TEMP-FILE in my select statements. The procedure division is the one that I think I need the most help with. Thank you. The following is what I have so far:
NEXT+ ...1....*....2....*....3....*....4....*....5....*....6....*....7..
152000 CONFIGURATION SECTION.
152100
153000 SOURCE-COMPUTER. B14.
154000 OBJECT-COMPUTER. B14.
155000*
156000 INPUT-OUTPUT SECTION.
157000
158000 FILE-CONTROL.
159300
171000 SELECT TRANSFILE ASSIGN TO DISK.
171400 SELECT SRT-FILE ASSIGN TO SORT DISK.
171440 SELECT TEMP-FILE ASSIGN TO DISK.
171500 SELECT OU1-PRINTFILE ASSIGN TO PRINTER.
172000
173000 I-O-CONTROL.
175000/
176000***************
200000 DATA DIVISION.
201000***************
201100
202000 FILE SECTION.
203000
2204000 SD SRT-FILE
206000 RECORD CONTAINS 44 CHARACTERS
207000 DATA RECORD IS SRT-REC.
208000 01 SRT-REC.
208050 03 SRT-OPID PIC X(3).
208100 03 SRT-SSN PIC 9(9).
208200 03 SRT-LNAM PIC X(20).
209000 03 SRT-AREA PIC X(4).
210000 03 SRT-TYPE PIC X(2).
210700 03 SRT-DATE.
210800 05 SRT-DATE-YY PIC 9(2).
210900 05 SRT-DATE-MM PIC 9(2).
210920 05 SRT-DATE-DD PIC 9(2).
210950
210970*COPY COULD BE FOUND IN THE PRODUCTION LIBRARY FILES
211000 COPY “TRANSFILE.".
211002*
211005 FD TEMP-FILE
211010 RECORD CONTAINS 44 CHARACTERS
211015 DATA RECORD IS TEMP-REC.
211020 01 TEMP-REC.
211021 03 TEMP-OPID PIC X(3).
211022 03 TEMP-SSN PIC 9(9).
211022 03 TEMP-SSN PIC 9(9).
211024 03 TEMP-LNAM PIC X(20).
211025 03 TEMP-AREA PIC X(4).
211030 03 TEMP-TYPE PIC X(2).
211035 03 TEMP-DATE.
211037 05 SRT-DATE-YY PIC 9(2).
211040 05 SRT-DATE-MM PIC 9(2).
211050 05 SRT-DATE-DD PIC 9(2).
211160*
212000 FD OU1-PRINTFILE.
212100 RECORD CONTAINS 132 CHARACTERS
213000 01 OU1-PRINT-REC.
214000 03 FILLER PIC X(132).
220000/
221000*******************
350000 DATA-BASE SECTION.
351000*******************
351100
361000/
362000*************************
400000 WORKING-STORAGE SECTION.
400002*************************
400004 01 SWITCHES.
400010 05 ARE-THERE-MORE-RECORDS PIC XXX VALUE "YES".
400020 05 X PIC 9(2) COMP.
400030 05 UPDATE-SIG PIC 9(1) VALUE 0.
400040*
400050 01 PRINT-FIELDS.
400060
400080 05 PAGE-COUNT PIC S9(3) VALUE ZERO.
400085 05 LINES-ON-PAGE PIC S9(3) VALUE +55.
400090 05 LINE-COUNT PIC S9(3) VALUE +99.
400140 05 SPACE-CONTROL PIC S9.
400190*
400200 01 WS-ITEMS.
400320 03 WS-TRANS-OPID PIC 9(3).
400370 03 CT-TYPE10-FOUND PIC 9(8).
400375 03 CT-TYPE7-FOUND PIC 9(8).
400380 03 CT-OVERRIDE PIC 9(8).
400400
400405*
400410 01 CURRENT-DATE-AND-TIME.
400415 05 CD-YEAR PIC 9999.
400420 05 CD-MONTH PIC 99.
400425 05 CD-DAY PIC 99.
400430 05 CD-HOURS PIC 99.
400435 05 CD-MINUTES PIC 99.
400440 05 FILLER PIC X(9).
400445
400450
401380*
401400 01 HEADING-LINE-1.
401500 05 FILLER PIC X(47) VALUE SPACE.
401600 05 FILLER PIC X(38) VALUE
401700 "USA DEPARTMENT ".
401800 05 PAGE-CNT PIC ZZZ9.
401900 05 FILLER PIC X(47) VALUE SPACE.
402000*
402100 01 HEADING-LINE-2.
402200 05 FILLER PIC X(57) VALUE SPACE.
402210 05 FILLER PIC X(18) VALUE "OFFICE OF TEACHING".
402250 05 FILLER PIC X(57) VALUE SPACE.
402270*
402272 01 HEADING-LINE-3.
402273 05 FILLER PIC X(41) VALUE SPACE.
402274 05 FILLER PIC X(21) VALUE "REPORT OF TRANSACTIONS".
402275 05 FILLER PIC X(29) VALUE "TRANSACTIONS USING OVERRIDE".
402276 05 FILLER PIC X(41) VALUE SPACE.
402278*
402280 01 HEADING-LINE-4.
402282 05 FILLER PIC X(38) VALUE SPACE.
402300 05 FILLER PIC X(7) VALUE "DATE: ".
402320 05 HL1-MONTH PIC 9(2).
402340 05 FILLER PIC X(1) VALUE "/".
402400 05 HL1-DAY PIC 9(2).
402500 05 FILLER PIC X(1) VALUE "/".
402600 05 HL1-YEAR PIC 9(4).
402700 05 FILLER PIC X(28) VALUE SPACE.
402800 05 FILLER PIC X(8) VALUE "PAGE: ".
402900 05 HL1-PAGE-NUMBER PIC ZZZ9.
403000 05 FILLER PIC X(41) VALUE SPACE.
403100*
403200 01 HEADING-LINE-5.
403250 05 FILLER PIC X(37) VALUE SPACE.
403300 05 FILLER PIC X(13) VALUE "SSN ".
403400 05 FILLER PIC X(22) VALUE "LAST NAME ".
403500 05 FILLER PIC X(6) VALUE "AREA ".
403600 05 FILLER PIC X(12) VALUE "EFF-DATE ".
403700 05 FILLER PIC X(5) VALUE "OPID ".
403800 05 FILLER PIC X(37) VALUE SPACE.
403900*
403910 01 DETAIL-LINE.
403920 05 FILLER PIC X(37) VALUE SPACE.
403930 05 DL-SSN PIC 9(9).
403940 05 FILLER PIC X(4) VALUE SPACE.
403950 05 DL-LNAME PIC X(20).
403960 05 FILLER PIC X(2) VALUE SPACE.
403970 05 DL-AREA PIC 9(4).
403980 05 FILLER PIC X(2) VALUE SPACE.
404000 05 DL-EFF-DATE PIC 9(8).
404020 05 FILLER PIC X(4) VALUE SPACE.
404040 05 DL-OPID PIC 9(3).
404060 05 FILLER PIC X(31) VALUE SPACE.
404080/
404100********************
600000 PROCEDURE DIVISION.
600100********************