Re: Opinions on approach, please...



Pete Dashwood wrote:
"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote in message news:6R4_j.341990$XH2.206583@xxxxxxxxxxxxxxxxxxxxxxxxx
(snip) The one question that I would ask is whether you are "converting" from a COBOL that supports both forward and backwards "browsing" of ISAM, i.e.
START LESS THAN
and
READ PREVIOUS

If so, does the approach you are consider handle this?

A good thought (and one I hadn't thought of), Bill.

It is Fujitsu so I think it does. Fortunately (for me... :-)), I'm pretty sure they never use it.

I think it could be achieved with:

EXEC SQL
DECLARE cursor cur01 for (SELECT * from Atable WHERE KeyField <= someValue ORDER BY KeyField DESCENDING)
END-EXEC

...but I'm certainly not sure, and things are difficult enough without that particular added complication :-).

I haven't used START against an indexed file in a batch COBOL program very often (on IBM mainframe it would be KSDS VSAM of course). In CICS it would be handled with EXEC CICS START BROWSE, READ NEXT (or PREV), END BROWSE. If I recall correctly, START doesn't really do anything except point to some position in the file for subsequent sequential processing. The real action is in the READ NEXT or READ PREVIOUS. I guess what I'm saying is that in order to emulate the behavior of START on the indexed file, you need to know START returns to the COBOL program. I would probably try to emulate START using a simple select for a specific key (and I am no expert on SQL). It probably depends on whether "record not found" is a valid COBOL result for a START command.

It seems to me that IBM batch COBOL does not support READ PREVIOUS on an indexed file, but it would be nice to have.



The other question is what your converted code will do with "file-sharing" in existing COBOL (that conforms to the old X/Open specification, e.g. Micro Focus). Traditionally, I think this played a significant part in programs that kept multiple indexes "in use" against the same file.

Not quite sure what you mean by this... Locking? VSAM share options? :-)

It isn't going to do anything with it :-) I'm hoping the RDB (SQL Server) will take care of it.

Thanks for the response, Bill.

Pete.

Without speaking for Bill, I assume that he meant record locking. I don't see any point in trying to emulate VSAM file sharing options, and you're probably right in hoping the RDB will handle all those issues.

In CICS, you can only have one indexed file record at a time READ for UPDATE. That's an implicit record lock and there are only two ways to release it, either by rewriting the record or by issuing an EXEC CICS UNLOCK on the file. If one record is locked, you cannot read another record for update in the same file.

In IBM Batch COBOL, I am not aware of any way to specifically UNLOCK a record read for update if the program does not rewrite it. Your RDB may have its own issues with locking rows or tables, and your interface may need to protect the COBOL program by managing commits and locks. I'm assuming you don't want to make any changes to the COBOL program's logic except for automatically replacing the I/O statements on a one for one basis.

As I said before, I am no expert on SQL, and my indexed file experience is only with VSAM in CICS and batch COBOL. So my thinking might not be very helpful to your situation.

Interestingly enough, IBM offers an option to replace KSDS VSAM files with DB2 tables, with no changes to the COBOL source code. I'm not sure if the program even needs to be recompiled.
http://tiny.cc/8qIQE

With kindest regards,


--
http://arnold.trembley.home.att.net/
.



Relevant Pages

  • Re: Cross-language challenge (of POSSIBLE interest)
    ... I have created a COBOL program that does what this is asking for. ... >challenge in the PL/I newsgroup - based on his post in the Fortran newsgroup - ... A few template statements in this word-processing benchmark challenge to ...
    (comp.lang.cobol)
  • Re: Style Wars WAS Re: EXIT PARAGRAPH on z/OS was Re: Bad habits of GOTO-using programmers
    ... Object Oriented programming in COBOL. ... (the data can only be accessed by a COBOL program), ... was run by IBM in Reading, ... Why does the best tool of the old paradigm need ...
    (comp.lang.cobol)
  • Fw: Calling a Web Service from COBOL
    ... How do I call a Web Service from a COBOL Program? ... Web services with COBOL batch programs, IMS, z/OS UNIX System Services, ... There's a somewhat dated IBM Redbook with information on XML and COBOL ...
    (bit.listserv.ibm-main)
  • Re: C03 abend when omitting CEE.SCEERUN from JCL
    ... In the case of normal COBOL termination (e.g., GOBACK from main, STOP RUN, ... COBOL will attempt to close any files that were left open and the C03 abend ... program deletes the COBOL program, this is where a C03 abend can occur. ...
    (bit.listserv.ibm-main)
  • Re: How proprietary is the "COBOL file system"
    ... It was precisely because I have no easy way to access the ISAM from ... COBOL is supposed to provide... ... system where a COBOL program had to be written in order to access it. ... target platform. ...
    (comp.lang.cobol)