Need Advice How to Increase FD layout to Existing Program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: Need Advice How to Increase FD layout to Existing Progra

Postby steve-myers » Sat Dec 08, 2012 9:38 am

crazycobol wrote:... I'm not sure about the wintel box you are referring too. Mainframe cobol should work almost the same as any other cobol.

I am using microfocus cobol software to compile. ...
I could be wrong, but I thought Microfocus Cobol was Wintel. You may not be aware of this, but "Wintel" is shorthand for M$ Windows running on an Intel 80x86 or compatible microcomputer.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Re: Need Advice How to Increase FD layout to Existing Progra

 

Re: Need Advice How to Increase FD layout to Existing Progra

Postby BillyBoyo » Sat Dec 08, 2012 10:50 am

I didn't say "INITIALIZE".

I said, what does the "48" tell you?

I explained that your suggested OPEN does not work for us, and that we would not even think of using two OPENs for the same file. For us it is simple, MOVE all the existing data, and initialise, note the small letters and even the British spelling, the new fields.

The most important thing for your now is what the "48" tells you.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby BillyBoyo » Sat Dec 08, 2012 11:27 am

01 XADDFREC.
    05   XADDFLDKEY
            10     XSSN          PIC X(09).
    05 XCITY                PIC X(30)
    05 XCOUNTRY        PIC X(30)
     05 FILLER             PIC X(200)


You have a key, a city and a country. I think 200 is probably excessive. What 200 bytes of data is there going to be for a city that no-one thought of originally? Doesn't matter.

Does your Cobol have SEQUENTIAL for your access-type? If so, code that for both files.

    48    A WRITE operation has been tried on a file not opened in the OUTPUT, I-O, or EXTEND mode, or on a file open I-O in the sequential access mode.


From Micro Focus. Same as ours :-)

I've look at some of your code. What is with the user-intervention? If that is needed, do it separately. Do a very simple thing. Read the existing file sequentially. Open the new file for OUTPUT and access being sequential. Read one record, move the data, set any new fields to their initial value (since you only have two fields, do we imagine that it is "country" you have added?) of, say, space.

If you then need another program for the users to set-up country (or whatever) then do that separately.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby NicC » Sat Dec 08, 2012 5:45 pm

What is with the formatting of the "coded" stuff? Is that how it appears on you screen? if so - tidy it up before posting. If someone is doing a minimum "coding" because you posted without doing the "coding" yourself then I suggest you "code" your posts before submitting - that gives the cyan on black looks like a mainframe screen effect.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby dick scherrer » Sun Dec 09, 2012 10:42 am

Hello,

"OPEN OUTPUT ADDFIELD" won't compile on the mainframe, so don't know what it tries to do on yours.
Maybe i'm again missing somethhing, but "open output addfield" should work on the mainframe just as "open output print-out" should work . . .

TS has considerable confusion about how files may be used. . .

I have no idea why there would be a need to initialize the input record area :?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby BillyBoyo » Sun Dec 09, 2012 2:01 pm

Gosh. I was so determined for it to be "different" that I read "ADDFIELD" as being some type of language ability :-) Clumsy.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby dick scherrer » Sun Dec 09, 2012 10:12 pm

Hello,

I could be wrong, but I thought Microfocus Cobol was Wintel. You may not be aware of this, but "Wintel" is shorthand for M$ Windows running on an Intel 80x86 or compatible microcomputer.
MicroFocus runs on multiple platforms, Wintel included.

When i first used MicroFocus COBOL, it was because i was assigned to be the technical lead to migrate an entire data center from MVS to Unix (HP-UX). The IBM world was 4 mvs boxes of varying size. We converted the entire application inventory without needing to change any of the procedure code. As i recall, there were slight changes in the SELECT / ASSIGN and maybe something in the FD. Been too long - nearly 20 years. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby crazycobol » Mon Dec 10, 2012 11:50 pm

I do appreciate everyone input on this. I am no expert in Cobol. and have very limited knowledge. With existing programs, I can work my way around it. Its when I have to create a totally new program that I sometimes get confused.

BillyBoyo - I would read the file if it existed. The file hasn't been created. How would I go about creating the file within the program?

DS - I understand your point in why do I have to initialize the field when there is no field to initialize as the file hasn't been created.

I'll mess around with it a little more and see if I can resolve it.

Yes error code 48 is what BillyBoyo posted which makes perfect sense.

Thank again.
crazycobol
 
Posts: 35
Joined: Fri Dec 04, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Need Advice How to Increase FD layout to Existing Progra

Postby dick scherrer » Tue Dec 11, 2012 12:25 am

Hello,

Its when I have to create a totally new program that I sometimes get confused.
Suggest you Never create a "totally new" program again. Somewhere on the system, there is another bit of code that accomplishes a similar task.

Clone that program and make the changes for your requirement.

I have not written a "brand new" COBOL program for nearlhy 30 years. One of the least productive activities is to start typing:
ID DIVISION.
PROGRAM-ID. NEWPGM.
AUTHOR. D.SCH.
etc
etc
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Need Advice How to Increase FD layout to Existing Progra

Postby Robert Sample » Tue Dec 11, 2012 12:42 am

How would I go about creating the file within the program?
Depending upon the operating system, usually opening a file for OUTPUT in COBOL and writing records to it causes the file to be created. If this is not the case for you, then you need to find out how to create files under your operating system -- which certainly is not a COBOL issue.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

PreviousNext

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post