Question:
Need help with my cobol code.?
ERIC S
2009-02-22 15:52:15 UTC
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
01 //XBYNY001 JOB ,
02 //*STEPCOB EXEC COB2CG
03 //STEPCOB EXEC COB2CG,PARM.COB=(QUOTE)
04 //SYSIN DD *
05 00010 IDENTIFICATION DIVISION.
06 00020 PROGRAM-ID. PROG2
07 00030 AUTHOR. fred
08 00110 *************************************************************
09 00120 *************************************************************
10 00130 ENVIRONMENT DIVISION.
11 00140 INPUT-OUTPUT SECTION.
12 00150 FILE-CONTROL.
13 00160
14 00170 SELECT IN-TEST-FILE ASSIGN INFILE.
15 00180 SELECT OUT-REPORT-FILE ASSIGN PRTRPT.
16 00190
17 002700*************************************************************
18 002900 DATA DIVISION.
19 003000 FILE SECTION.
20 00310
21 003200
22 003300 FD IN-TEST-FILE
23 003600 RECORD CONTAINS 80 CHARACTERS.
24 003802 01 IN-TEST-REC.
25 003903 05 COMPANY-NAME PIC X(15).
26 003903 05 STREET-ADDRESS PIC X(15).
27 003903 05 CITY-STATE-ZIP PIC X(15).
28 003903 05 EMPLOYEE-NAME PIC X(20).
29 003903 05 EMPLOYEE-TITLE PIC X(15).
30 004004
31 004105 FD OUT-REPORT-FILE.
32 004600 01 OUT-REPORT-REC PIC X(120).
33 004700
34 00490 WORKING-STORAGE SECTION.
37 005200 01 MORE-INPUT PIC X VALUE "Y".
38 009500*************************************************************
39 009800 PROCEDURE DIVISION.
40 009900
41 010000*MAIN LINE
42 010100 PERFORM INITIALIZATION
43 010400 PERFORM MAIN-LOOP UNTIL MORE-INPUT IS EQUAL TO "N"
44 010700 PERFORM TERMINATION
45 011406 GOBACK.
46 INITIALIZATION.
47 OPEN INPUT IN-TEST-FILE
48 OUTPUT OUT-REPORT-FILE
49 READ IN-TEST-FILE
50 AT END
51 MOVE "N" TO MORE-INPUT
52 .
53 MAIN-LOOP.
54 MOVE EMPLOYEE-NAME TO OUT-REPORT-REC
55.0 WRITE OUT-REPORT-REC
55.5 AFTER ADVANCING 2 LINES
56.0 MOVE EMPLOYEE-TITLE TO OUT-REPORT-REC
57.0 WRITE OUT-REPORT-REC
58.0 MOVE COMPANY-NAME TO OUT-REPORT-REC
59.0 WRITE OUT-REPORT-REC
60.0 MOVE STREET-ADDRESS TO OUT-REPORT-REC
61.0 WRITE OUT-REPORT-REC
62.0 MOVE CITY-STATE-ZIP TO OUT-REPORT-REC
63.0 WRITE OUT-REPORT-REC
64.0 READ IN-TEST-FILE
65.
Three answers:
The Terminated
2009-02-23 08:11:13 UTC
What is PRTRPT? If it is an actual printer, your program should advance 2 lines after printing the name. If it is a text file, some text editors don't handle the carriage control characters properly. You'll have to substitute this for lines 54-55.5

54 MOVE SPACES TO OUT-REPORT-REC.

54.5 WRITE OUT-REPORT-REC.

54.7 WRITE OUT-REPORT-REC.

55.0 WRITE OUT-REPORT-REC FROM EMPLOYEE-NAME.
coolanswerer
2009-02-22 23:56:47 UTC
Use Java!
2009-02-22 23:56:28 UTC
Is there a question?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...