Page 2 of 3

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

PostPosted: Sat Dec 08, 2012 9:38 am
by steve-myers
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.

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

PostPosted: Sat Dec 08, 2012 10:50 am
by BillyBoyo
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.

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

PostPosted: Sat Dec 08, 2012 11:27 am
by BillyBoyo
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.

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

PostPosted: Sat Dec 08, 2012 5:45 pm
by NicC
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.

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

PostPosted: Sun Dec 09, 2012 10:42 am
by dick scherrer
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 :?

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

PostPosted: Sun Dec 09, 2012 2:01 pm
by BillyBoyo
Gosh. I was so determined for it to be "different" that I read "ADDFIELD" as being some type of language ability :-) Clumsy.

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

PostPosted: Sun Dec 09, 2012 10:12 pm
by dick scherrer
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. . .

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

PostPosted: Mon Dec 10, 2012 11:50 pm
by crazycobol
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.

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

PostPosted: Tue Dec 11, 2012 12:25 am
by dick scherrer
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

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

PostPosted: Tue Dec 11, 2012 12:42 am
by Robert Sample
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.