我将分享我的硬代码和编译器输出。
编译器输出:
J E S 2 J O B L O G -- S Y S T E M 8 5 6 1 -- N O D E S V S C J E S 2
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
000001 identification division.
000002 program-id. A1CLIST.
000003 date-written. 1/19/2024.
000004 author. Francisco Gonzalez Moreno.
000005 *Description: COBOL program to create a contact list.
000006 *
000007 environment division.
000008 configuration section.
000009 *
000010 input-output section.
000011 file-control.
000012 *
000013 select output-file 19
000014 assign to OUTFILE
000015 organization is sequential.
000016 *
000017 data division.
000018 file section.
000019 FD OUTPUT-FILE
000020 recording mode is F
000021 data record is OUTPUT-LINE *
000022 record contains 81 characters.
000023 *
000024 * Outputs
000025 01 OUTPUT-LINE PIC X(81).
000026 *
000027 working-storage section.
000028 *
000029 *> Heading
000030 01 HEADING-VARIABLE.
000031 05 HEADING-TEXT PIC X(12)
000032 VALUE "Contact List".
000033 *>----+----+--
000034 05 FILLER PIC X(10)
000035 VALUE SPACES. *> spaces within sentence IMP
000036 *Variables
000037 01 CONTACT-VARIABLE.
000038 05 NAME PIC X(25).
000039 05 FILLER PIC X(5)
000040 VALUE SPACES. *> spaces within sentence IMP
000041 05 EMAIL PIC X(34).
000042 05 FILLER PIC X(5)
000043 VALUE SPACES. *> spaces within sentence IMP
000044 05 PHONE-NUMBER PIC X(12).
000045 * formating
000046 01 BLANK-LINE PIC X(40)
000047 VALUE SPACES. *> spaces within sentence IMP
000048
000049 * main code
000050 procedure division.
000051 000-main.
000052 *> Open the output file
000053 OPEN OUTPUT OUTPUT-FILE. 19
000054
000055 *
000056 * Header
000057 *
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.3.0 P230918 A1CLIST Date 01/20/2024 Time 15:05:55 Page 4
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
000058 MOVE HEADING-TEXT TO OUTPUT-LINE. 31 25
000059 *> Displaying the header
000060 WRITE OUTPUT-LINE. 25
000061 WRITE BLANK-LINE. 46
==000061==> IGYPS2143-S Expected a record-name, but found "BLANK-LINE". The statement was
discarded.
000062 *
000063 * 1st person
000064 *
000065 *> Entering information for 1st person
000066 MOVE "Francisco Gonzalez Moreno" TO NAME. 38
000067 *>----+----0----+----0----+
000068 MOVE "[email protected]" TO EMAIL. 41
000069 *>----+----0----+----0----+----0----
000070 MOVE "289-943-3120" TO PHONE-NUMBER. 44
000071 *>----+----0--
000072 *
000073 *> Moving all inputs to OUTPUT-LINE
000074 MOVE NAME TO OUTPUT-LINE. 38 25
000075 MOVE EMAIL TO OUTPUT-LINE. 41 25
000076 MOVE PHONE-NUMBER TO OUTPUT-LINE. 44 25
000077 *> and ensuring visibility
000078 *> Displaying 1st contact information
000079 WRITE OUTPUT-LINE. 25
000080 WRITE BLANK-LINE. 46
==000080==> IGYPS2143-S Expected a record-name, but found "BLANK-LINE". The statement was
discarded.
000081 *
000082 * 2nd person
000083 *
000084 *> Entering information for 2nd person
000085 MOVE "Steven Brelik" TO NAME. 38
000086 *>----+----0
000087 MOVE "[email protected]" TO EMAIL. 41
000088 *>----+----0----+----0---
000089 MOVE "987-654-3210" TO PHONE-NUMBER. 44
000090 *>----+----0--
000091 *
000092 *> Moving all inputs to OUTPUT-LINE
000093 MOVE NAME TO OUTPUT-LINE. 38 25
000094 MOVE EMAIL TO OUTPUT-LINE. 41 25
000095 MOVE PHONE-NUMBER TO OUTPUT-LINE. 44 25
000096 *> Displaying 2nd contact information
000097 *> and ensuring visibility
000098 WRITE OUTPUT-LINE. 25
000099 WRITE BLANK-LINE. 46
==000099==> IGYPS2143-S Expected a record-name, but found "BLANK-LINE". The statement was
discarded.
000100 *
000101 * 3rd person
000102 *
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.3.0 P230918 A1CLIST Date 01/20/2024 Time 15:05:55 Page 5
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
000103 *> Entering information for 3rd person
000104 MOVE "Robbie McDonald" TO NAME. 38
000105 *>----+----0----+
000106 MOVE "[email protected]" TO EMAIL. 41
000107 *>----+----0----+----0----+
000108 MOVE "555-123-4567" TO PHONE-NUMBER. 44
000109 *>----+----0--
000110 *
000111 *> Moving all inputs to OUTPUT-LINE
000112 MOVE NAME TO OUTPUT-LINE. 38 25
000113 MOVE EMAIL TO OUTPUT-LINE. 41 25
000114 MOVE PHONE-NUMBER TO OUTPUT-LINE. 44 25
000115 *> Displaying 3rd contact information
000116 *> and ensuring visibility
000117 WRITE OUTPUT-LINE. 25
000118
000119 *
000120 *> Close the output file
000121 CLOSE OUTPUT-FILE. 19
000122 goback.
000123 *
000124 end program A1CLIST. 2
000125
identification division.
program-id. A1CLIST.
date-written. 1/19/2024.
author. Francisco Gonzalez Moreno.
*Description: COBOL program to create a contact list.
*
environment division.
configuration section.
*
input-output section.
file-control.
*
select output-file
assign to OUTFILE
organization is sequential.
*
data division.
file section.
FD OUTPUT-FILE
recording mode is F
data record is OUTPUT-LINE
record contains 81 characters.
*
* Outputs
01 OUTPUT-LINE PIC X(81).
*
working-storage section.
*
*> Heading
01 HEADING-VARIABLE.
05 HEADING-TEXT PIC X(12)
VALUE "Contact List".
*>----+----+--
05 FILLER PIC X(10)
VALUE SPACES. *> spaces within sentence
*Variables
01 CONTACT-VARIABLE.
05 NAME PIC X(25).
05 FILLER PIC X(5)
VALUE SPACES. *> spaces within sentence
05 EMAIL PIC X(34).
05 FILLER PIC X(5)
VALUE SPACES. *> spaces within sentence
05 PHONE-NUMBER PIC X(12).
* formating
01 BLANK-LINE PIC X(40)
VALUE SPACES. *> spaces within sentence
* main code
procedure division.
000-main.
*> Open the output file
OPEN OUTPUT OUTPUT-FILE.
*
* Header
*
MOVE HEADING-TEXT TO OUTPUT-LINE.
*> Displaying the header
WRITE OUTPUT-LINE.
WRITE BLANK-LINE.
*
* 1st person
*
*> Entering information for 1st person
MOVE "Francisco Gonzalez Moreno" TO NAME.
*>----+----0----+----0----+
MOVE "[email protected]" TO EMAIL.
*>----+----0----+----0----+----0----
MOVE "289-943-3120" TO PHONE-NUMBER.
*>----+----0--
*
*> Moving all inputs to OUTPUT-LINE
MOVE NAME TO OUTPUT-LINE.
MOVE EMAIL TO OUTPUT-LINE.
MOVE PHONE-NUMBER TO OUTPUT-LINE.
*> and ensuring visibility
*> Displaying 1st contact information
WRITE OUTPUT-LINE.
WRITE BLANK-LINE.
*
* 2nd person
*
*> Entering information for 2nd person
MOVE "Steven Brelik" TO NAME.
*>----+----0
MOVE "[email protected]" TO EMAIL.
*>----+----0----+----0---
MOVE "987-654-3210" TO PHONE-NUMBER.
*>----+----0--
*
*> Moving all inputs to OUTPUT-LINE
MOVE NAME TO OUTPUT-LINE.
MOVE EMAIL TO OUTPUT-LINE.
MOVE PHONE-NUMBER TO OUTPUT-LINE.
*> Displaying 2nd contact information
*> and ensuring visibility
WRITE OUTPUT-LINE.
WRITE BLANK-LINE.
*
* 3rd person
*
*> Entering information for 3rd person
MOVE "Robbie McDonald" TO NAME.
*>----+----0----+
MOVE "[email protected]" TO EMAIL.
*>----+----0----+----0----+
MOVE "555-123-4567" TO PHONE-NUMBER.
*>----+----0--
*
*> Moving all inputs to OUTPUT-LINE
MOVE NAME TO OUTPUT-LINE.
MOVE EMAIL TO OUTPUT-LINE.
MOVE PHONE-NUMBER TO OUTPUT-LINE.
*> Displaying 3rd contact information
*> and ensuring visibility
WRITE OUTPUT-LINE.
*
*> Close the output file
CLOSE OUTPUT-FILE.
goback.
*
end program A1CLIST.
希望得到答案,这是我第一次使用堆栈溢出,所以不知道会发生什么
BLANK-LINE
不是与文件关联的记录名称。然而,OUTPUT-LINE
是。使用以下内容:
WRITE OUTPUT-LINE FROM BLANK-LINE.