IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

S001 abend in reading/writing a file using structures.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohitcognizant

New User


Joined: 13 Feb 2007
Posts: 54
Location: Pune India

PostPosted: Thu Jun 14, 2007 2:39 pm
Reply with quote

I have to declare 4 structures , populate them by reading from a file and write them into a file.
I have tried the following method.
I get a system abend S001 when i run this.
Please do help me out.

PGM9:PROC OPTIONS(MAIN);
DCL SORT1 FILE INPUT RECORD;
DCL SORT FILE UPDATE RECORD;

DCL 1 STRUCT1,
2 NUM1 PIC '999' INIT(123),
2 UNSD1 CHAR(77);
DCL 1 STRUCT2,
2 NUM1 PIC '999' INIT(456),
2 UNSD1 CHAR(77);
DCL 1 STRUCT3,
2 NUM1 PIC '999' INIT(789),
2 UNSD1 CHAR(77);
DCL 1 STRUCT4,
2 NUM1 PIC '999' INIT(000),
2 UNSD1 CHAR(77);


OPEN FILE(SORT1);
OPEN FILE(SORT);

READ FILE(SORT1) INTO(STRUCT1);
PUT SKIP LIST(STRUCT1);
WRITE FILE(SORT) FROM(STRUCT1);
WRITE FILE(SORT) FROM(STRUCT2);
WRITE FILE(SORT) FROM(STRUCT3);
WRITE FILE(SORT) FROM(STRUCT4);*/

CLOSE FILE(SORT1);
CLOSE FILE(SORT);

END PGM9; [/img][/quote]
Back to top
View user's profile Send private message
rohitcognizant

New User


Joined: 13 Feb 2007
Posts: 54
Location: Pune India

PostPosted: Thu Jun 14, 2007 2:42 pm
Reply with quote

I tried to read from a file and populate it into the following structure and then write the same into a new file.
I get a system abend when i run this.
What could be the problem?
Is there anything wrong with the fixed dec declaration?


PGM9:PROC OPTIONS(MAIN);
DCL SORT1 FILE INPUT RECORD;
DCL SORT FILE UPDATE RECORD;

DCL 1 STRUCT1,
2 NUM1 fixed dec(3),
2 UNSD1 CHAR(77);


OPEN FILE(SORT1);
OPEN FILE(SORT);

READ FILE(SORT1) INTO(STRUCT1);
PUT SKIP LIST(STRUCT1);
WRITE FILE(SORT) FROM(STRUCT1);


CLOSE FILE(SORT1);
CLOSE FILE(SORT);

END PGM9;
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Jun 14, 2007 11:50 pm
Reply with quote

Hello,

Please post the jcl from the abended run as well as the actual diagnostic info that will be in the jes output.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Mon Jun 18, 2007 5:11 pm
Reply with quote

Why are you using structures if you simply want to copy the inputfile? Usually one programs:
Code:

DCL INP_REC CHAR(80);
DCL 1 INP_STRUC BASED(ADDR(INP_REC)),
       3 KEYFIELD PIC'999',
       3 FILLER CHAR(77);

READ FILE(INP_FILE) INTO (INP_REC);


And why is your outputfile declared as UPDATE?

Why do you not use a utility like IEBGENER or IDCAMS to duplicate a file?
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Mon Jun 18, 2007 5:13 pm
Reply with quote

And as Dick wrote: post all your info so we may find out which file is in failure; you've got 3 sort, sort1 and sysout.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Avoid job abend on dataset held by us... JCL & VSAM 6
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
No new posts After newcopy the CICS program user f... CICS 7
Search our Forums:


Back to Top