000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. PHNADD01.
000300*--------------------------------------------------
000400* This program creates a new data file if necessary
000500* and adds records to the file from user entered
000600* data.
000700*--------------------------------------------------
000800 ENVIRONMENT DIVISION.
000900 INPUT-OUTPUT SECTION.
001000 FILE-CONTROL.
001100 SELECT OPTIONAL PHONE-FILE
001200*or SELECT PHONE-FILE
001300 ASSIGN TO "INFILE"
001400*or ASSIGN TO "phone"
001500 ORGANIZATION IS SEQUENTIAL.
001600
001700 DATA DIVISION.
001800 FILE SECTION.
001900 FD PHONE-FILE
002000 LABEL RECORDS ARE STANDARD.
002100 01 PHONE-RECORD.
002200 05 PHONE-LAST-NAME PIC X(20).
002300 05 PHONE-FIRST-NAME PIC X(20).
002400 05 PHONE-NUMBER PIC X(15).
002500
002600 WORKING-STORAGE SECTION.
002700
002800* Variables for SCREEN ENTRY
002900 01 PROMPT-1 PIC X(9) VALUE "Last Name".
003000 01 PROMPT-2 PIC X(10) VALUE "First Name".
003100 01 PROMPT-3 PIC X(6) VALUE "Number".
003200
003300 01 YES-NO PIC X.
003400 01 ENTRY-OK PIC X.
003500
003600 PROCEDURE DIVISION.
003700 MAIN-LOGIC SECTION.
003800 PROGRAM-BEGIN.
003900
004000 PERFORM OPENING-PROCEDURE.
004100 MOVE "Y" TO YES-NO.
004200 PERFORM ADD-RECORDS
004300 UNTIL YES-NO = "N".
004400 PERFORM CLOSING-PROCEDURE.
004500
004600 PROGRAM-DONE.
004700 STOP RUN.
004800
004900* OPENING AND CLOSING
005000
005100 OPENING-PROCEDURE.
005200 OPEN EXTEND PHONE-FILE.
005300
005400 CLOSING-PROCEDURE.
005500 CLOSE PHONE-FILE.
005600
005700 ADD-RECORDS.
005800 MOVE "N" TO ENTRY-OK.
005900 PERFORM GET-FIELDS
006000 UNTIL ENTRY-OK = "Y".
006100 PERFORM ADD-THIS-RECORD.
006200 PERFORM GO-AGAIN.
006300
006400 GET-FIELDS.
006500 MOVE SPACE TO PHONE-RECORD.
006600 DISPLAY PROMPT-1 " ? ".
006700 ACCEPT PHONE-LAST-NAME.
006800 DISPLAY PROMPT-2 " ? ".
006900 ACCEPT PHONE-FIRST-NAME.
007000 DISPLAY PROMPT-3 " ? ".
007100 ACCEPT PHONE-NUMBER.
007200 PERFORM VALIDATE-FIELDS.
007300
007400 VALIDATE-FIELDS.
007500 MOVE "Y" TO ENTRY-OK.
007600 IF PHONE-LAST-NAME = SPACE
007700 DISPLAY "LAST NAME MUST BE ENTERED"
007800 MOVE "N" TO ENTRY-OK.
007900
008000 ADD-THIS-RECORD.
008100 WRITE PHONE-RECORD.
008200
008300 GO-AGAIN.
008400 DISPLAY "GO AGAIN?".
008500 ACCEPT YES-NO.
008600 IF YES-NO = "y"
008700 MOVE "Y" TO YES-NO.
008800 IF YES-NO NOT = "Y"
008900 MOVE "N" TO YES-NO.
009000
and here is the error comes in sysout
Code:
Last Name ?
First Name ?
Number ?
GO AGAIN?
CEE3250C The system or user abend SB14 R=00000004 was issued.
From compile unit PHNADD01 at entry point PHNADD01 at statement 55 at compile unit offset +000005B0 at entry
offset +000005B0 at address 23D00DB0.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Jul 31, 2007 11:03 am Post subject:
mrinalsolanki,
why are you using a PDS as your input? Is the member TEST created even before the program ran?
Check this for an explantion of the error SB14 Rc=04
Code:
B14
Explanation: The error occurred during processing of a CLOSE macro
instruction for a partitioned data set opened for output to a member. This
system completion code is accompanied by message IEC217I. Refer to the
explanation of message IEC217I for complete information about the task
that was ended and for an explanation of the return code (rc in the
message text) in register 15.
Application Programmer Response: Respond as indicated for message
IEC217I.
System Programmer Response: If the error recurs and the program is not in
error, look at the messages in the job log for more information. Search
problem reporting data bases for a fix for the problem. If no fix exists,
contact the IBM Support Center. Provide the JCL and the program listing
for the job.
04 A duplicate name was found in the directory of a partitioned
data set. The CLOSE routine attempted to add a member name to
the directory using the STOW macro instruction, but a code of 4
was returned, indicating that the member already exists. Specify
a different member name, or remove the old member name using the
IEHPROGM utility, or specify DISP=OLD on the DD statement.
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Wed Aug 01, 2007 1:42 am Post subject:
you can't use DISP=MOD on a PDS member. Also, it looks like you are assuming that DISP=NEW simply creates the member within an existing PDS. But the DISP parameter (and all the others as well) refers to the data set, not the member within the data set. You don't need to specifically create the new member. But if you want to add to an existing member, you'll need to read the old one and rewrite a new one.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum