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

Help in File Handling


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Sat Sep 12, 2009 2:40 am
Reply with quote

I need to write in VB Member of a PDS, that contains teh decompiled ACF2 Rules.

The Propertied of PDS is :
Management class . . :INTERIM
Storage class . . . : BASE
Volume serial . . . : DMAS09
Device type . . . . : 3390
Data class . . . . . : DCDEFLT
Organization . . . : PO
Record format . . . : VB
Record length . . . : 255
Block size . . . . : 3665
1st extent tracks . : 6
Secondary tracks . : 14
Data set name type : PDS


When i am writing in a member of this PDS,
in JCL i am using

Code:
//RULE     DD  DSN=T0084GK.RULETREE(RULE),DISP=MOD



and in cobol file decleration is :


Code:
DATA DIVISION.
FILE SECTION. 

FD   RULE                             
     RECORDING MODE IS V             
     LABEL RECORDS ARE STANDARD       
     BLOCK CONTAINS 0 RECORDS         
     DATA RECORD IS RUL-REC.         
01   RUL-REC PIC X(255).   

PROCEDURE DIVISION.

WRITE RUL-REC FROM NEW-RUL.



i think i am missing some where icon_sad.gif

Thanks in Advance for any review:
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Sep 12, 2009 3:05 am
Reply with quote

Hello,

The FD looks inconsistent. . . V is specified, but only a fixed-length 01 is shown.

Why is DISP=MOD being used?

Is there any compiler error or abend? If yes, these need to be posted.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Sep 12, 2009 3:22 am
Reply with quote

Quote:
Record format . . . : VB
Record length . . . : 255
You also need to adjust your COBOL record length to account for the Block Descriptor Word -- your COBOL program should not use more than 251 bytes under the FD.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Sat Sep 12, 2009 10:51 am
Reply with quote

@ dick scherrer :
There is no compiler error or abend.
the code is working fine.

DISP=MOD is used as the output file contains some records, ani i need to append a new record in that which is in 'NEW-RUL"
Also it is running in with RC 0, but not writting anything in the outpou, but delete all the records of the output File.


@ Robert Sample:

Will the below work???

DATA DIVISION.
FILE SECTION.

FD RULE
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS 0 RECORDS
DATA RECORD IS RUL-REC.
01 RUL-REC PIC X(251).

PROCEDURE DIVISION.

WRITE RUL-REC FROM NEW-RUL.


Thanks:
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Sep 12, 2009 11:17 am
Reply with quote

don't think you can't MOD a pds,

and have it work.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Sat Sep 12, 2009 2:14 pm
Reply with quote

DSN is used :
//RULE DD DSN=T0084GK.RULETREE(RULE),DISP=MOD

RULE is a member of the PDS whose properties is in above posts.

Cant we use MOD withmember of PDS?

Is there any other criticality writing VB Files.?

Thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Sep 12, 2009 6:31 pm
Reply with quote

There is a link to manuals at the top of the page. The JCL Language Reference manual states:
Quote:
12.19.8 Disposition of Partitioned Data Sets (PDSs and PDSEs)

When you specify DISP=MOD or DISP=NEW for a partitioned data set (PDS) or partitioned data set extended (PDSE), and you also specify a member name in the DSNAME parameter, the member name must not already exist. If the member name already exists, the system terminates the job.


What you've got will work but if you're expecting records that vary in length, your code will not do that -- every record written to the file will be 251 bytes long.

Also, when using COBOL and having trouble with files, the file status field provides a lot of information. If you haven't used one before, the COBOL Language Reference manual (link at the top of the page) will tell you how to use it. Add one and let us know what the file status codes are for the open and the write statement.
Back to top
View user's profile Send private message
jignesh.rathod

New User


Joined: 03 Jan 2011
Posts: 1
Location: pune

PostPosted: Mon Jan 03, 2011 7:00 pm
Reply with quote

Quote:
12.19.8 Disposition of Partitioned Data Sets (PDSs and PDSEs)

When you specify DISP=MOD or DISP=NEW for a partitioned data set (PDS) or partitioned data set extended (PDSE), and you also specify a member name in the DSNAME parameter, the member name must not already exist. If the member name already exists, the system terminates the job.


can anyone tell me why system terminates the job or can somebody provide me with relevent link.

also if any one can help me regarding appending data in pds member from another pds member or ps member.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Jan 03, 2011 7:38 pm
Reply with quote

You should define a 01 record containing 255 bytes, but you have to define the first 4 bytes as the Block Descriptor Word and fill in the length of the data record to be written in the 2 first bytes (in binary).

You cannot append records to a PDS member. You will have to read the data to a temporary dataset, concatenate the new records, and write everything to the member in a new step.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jan 03, 2011 8:40 pm
Reply with quote

Hi Kjeld,

The 255 is the original question rather than the current question, i believe. . .

@jignesh rathod
Welcome to the forum,

When you have a question, you should start a new topic for your question rather than post a reply to some inactive topic as this can cause confusion.

Quote:
can anyone tell me why system terminates the job or can somebody provide me with relevent link.
Because this is the way partitioned datasets are designed to work. Why is not so important as knowing what can or cannot be done.

To do what you want, you should do as Kjeld suggests:
Quote:
You cannot append records to a PDS member. You will have to read the data to a temporary dataset, concatenate the new records, and write everything to the member in a new step.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top