Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help in File Handling

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Help in File Handling
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

Site Director


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

PostPosted: Sat Sep 12, 2009 3:05 am    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Sat Sep 12, 2009 3:22 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Sat Sep 12, 2009 6:31 pm    Post subject:
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    Post subject: Reply to: Help in File Handling
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    Post subject:
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

Site Director


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

PostPosted: Mon Jan 03, 2011 8:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 0 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us