Code Comments
Programming Forum and web based access to our favorite programming groups.Hi! We are doing a proof of concept project to see what are the issues when converting from VMS Cobol to Microfocus Cobol under Linux. One of the problems we're facing now is that Microfocus Cobol doesn't seem to like group names when defining a DB table. For example, we have a table called t01_table that is defined in VMS Cobol like this: 01 t01-table-rec. 05 t01-prime. 10 t01-tabno pic x(03). 10 t01-de-key pic x(14). 05 t01-de-char pic x(62). 05 t01-suspend pic x(01). 05 t01-filler pic x(30). When I pre-compile a program that uses this definition using Oracle's Pro*COBOL precompiler, I get this error: Error at line 13, column 24 in file t01.read select * into :t01-table-rec .......................1 PCB-S-00208, Incorrect type for host variable "T01-PRIME" After some tests we have determined that the problem is that t01-prime is a group name. If I take it out and promote the two fields below it from level 10 to level 05, the program pre-compiles correctly. But I cannot use this technique because it would mean a major revision of almost one thousand programs, something we don't have the time for. Therefore, my question is, is there a way to circumvent this problem? Some precompilation switch that will make Microfocus Cobol accept the group name? I have already posted this same question to the MicroFocus development forum and the answers that I got indicate that MF Cobol simply doesn't allow that. Also, the procob manual states that ************* Pro*COBOL allows the use of group items in embedded SQL statements. Group items with elementary items (containing only one level) can be used as host variables ************* I'm trying posting here in this group as a last effort before dumping MF Cobol... Can anyone think of a way for me to keep my definition as is and still be able to pre-compile? Thanks in advance for any help. Valdir Jorge
Post Follow-up to this messageValdir Jorge <vjorge@vax2.concordia.ca> wrote in message news:<40A38884.9090401@vax2.concor dia.ca>... > Hi! > > We are doing a proof of concept project to see what are the issues when > converting from VMS Cobol to Microfocus Cobol under Linux. One of the > problems we're facing now is that Microfocus Cobol doesn't seem to like > group names when defining a DB table. For example, we have a table > called t01_table that is defined in VMS Cobol like this: > > 01 t01-table-rec. > 05 t01-prime. > 10 t01-tabno pic x(03). > 10 t01-de-key pic x(14). > 05 t01-de-char pic x(62). > 05 t01-suspend pic x(01). > 05 t01-filler pic x(30). > > When I pre-compile a program that uses this definition using Oracle's > Pro*COBOL precompiler, I get this error: > > Error at line 13, column 24 in file t01.read > select * into :t01-table-rec > .......................1 > PCB-S-00208, Incorrect type for host variable "T01-PRIME" > > After some tests we have determined that the problem is that t01-prime > is a group name. If I take it out and promote the two fields below it > from level 10 to level 05, the program pre-compiles correctly. But I > cannot use this technique because it would mean a major revision of > almost one thousand programs, something we don't have the time for. > Therefore, my question is, is there a way to circumvent this problem? > Some precompilation switch that will make Microfocus Cobol accept the > group name? > > I have already posted this same question to the MicroFocus development > forum and the answers that I got indicate that MF Cobol simply doesn't > allow that. Also, the procob manual states that > > ************* > Pro*COBOL allows the use of group items in embedded SQL statements. > Group items with elementary items (containing only one level) can be > used as host variables > ************* > > I'm trying posting here in this group as a last effort before dumping MF > Cobol... Can anyone think of a way for me to keep my definition as is > and still be able to pre-compile? Thanks in advance for any help. > > Valdir Jorge Hi Valdir! We had the same problem when migrating from C-ISAM files to an Oracle database. Unfortunately I don't think you're going ot like this answer: Your group item, t01-table-rec, is not a group item composed of elementray items because the t01-prime field is also a group item. This violates the rule established in the Pro*COBOL manual. Here is the only work-around which we found to be effective and of minimal impact in terms of code changes: 01 t01-table-rec. 05 t01-prime pic x(17). 05 t01-prime-r redefines t01-prime. 10 t01-tabno pic x(03). 10 t01-de-key pic x(14). 05 t01-de-char pic x(62). 05 t01-suspend pic x(01). 05 t01-filler pic x(30). Now you're group item only contains elementary items (since the redefinition is "ignored" by Pro*COBOL). You should find that you're code works as expected now. It's a bit of a pain, but if you've got your table/record layouts isolated, it shouldn't be a major undertaking to make this type of modification. I was unable to find a switch (or other shortcut) to accomplish this, so I'm going to follow this post eagerly to see if someone has learned some new tricks. Good luck! Chris
Post Follow-up to this messageHi Chris! You wrote: > We had the same problem when migrating from C-ISAM files to an Oracle > database. Unfortunately I don't think you're going ot like this > answer: > > Your group item, t01-table-rec, is not a group item composed of > elementray items because the t01-prime field is also a group item. > This violates the rule established in the Pro*COBOL manual. > > Here is the only work-around which we found to be effective and of > minimal impact in terms of code changes: > > 01 t01-table-rec. > 05 t01-prime pic x(17). > 05 t01-prime-r redefines t01-prime. > 10 t01-tabno pic x(03). > 10 t01-de-key pic x(14). > 05 t01-de-char pic x(62). > 05 t01-suspend pic x(01). > 05 t01-filler pic x(30). > > Now you're group item only contains elementary items (since the > redefinition is "ignored" by Pro*COBOL). You should find that you're > code works as expected now. It's a bit of a pain, but if you've got > your table/record layouts isolated, it shouldn't be a major > undertaking to make this type of modification. I tried your solution and now I'm getting this error message: Error at line 13, column 24 in file t01.read select * into :t01-table-rec .......................1 PCB-S-00208, Incorrect type for host variable "T01-PRIME-R" So, now it is complaining about the new variable t01-prime-r!! > I was unable to find a switch (or other shortcut) to accomplish this, > so I'm going to follow this post eagerly to see if someone has learned > some new tricks. Me, too, I'll keep my hopes up... Valdir Jorge
Post Follow-up to this messageAm 13.05.04 schrieb vjorge@vax2.concordia.ca (Valdir Jorge) auf /COMP/LANG/COBOL in 40A38884.9090401@vax2.concordia.ca ueber MicroFocus Cobol: use of group names in DB definitions VJ> 01 t01-table-rec. VJ> 05 t01-prime. VJ> 10 t01-tabno pic x(03). VJ> 10 t01-de-key pic x(14). VJ> 05 t01-de-char pic x(62). VJ> 05 t01-suspend pic x(01). VJ> 05 t01-filler pic x(30). VJ> VJ> When I pre-compile a program that uses this definition using Oracle's VJ> Pro*COBOL precompiler, I get this error: VJ> VJ> Error at line 13, column 24 in file t01.read VJ> select * into :t01-table-rec VJ> .......................1 VJ> PCB-S-00208, Incorrect type for host variable "T01-PRIME" VJ> VJ> After some tests we have determined that the problem is that VJ> t01-prime is a group name. How about REDEFINing it? Like this: 05 t01-prime. 05 filler redefines t01-prime. 10 t01-tabno pic x(03). 10 t01-de-key pic x(14). Does that work? Yours, Lüko Willms http://www.mlwerke.de /--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten -- "Die Arbeit in weißer Haut kann sich nicht dort emanzipieren, wo sie in schwarzer Haut gebrandmarkt wird." - Karl Marx 12.11.1866
Post Follow-up to this messageValdir Jorge wrote: > Hi! > > We are doing a proof of concept project to see what are the issues > when converting from VMS Cobol to Microfocus Cobol under Linux. One of > the problems we're facing now is that Microfocus Cobol doesn't seem to > like group names when defining a DB table. For example, we have a table > called t01_table that is defined in VMS Cobol like this: > > 01 t01-table-rec. > 05 t01-prime. > 10 t01-tabno pic x(03). > 10 t01-de-key pic x(14). > 05 t01-de-char pic x(62). > 05 t01-suspend pic x(01). > 05 t01-filler pic x(30). how about... 01 t01-table-rec. 05 t01-tabno pic x(03). 05 t01-de-key pic x(14). [snip] 66 t01-prime renames t01-tabno thru t01-de-key That way, you've still got t01-prime named, it's still alphanumeric, and pro*cobol shouldn't gripe because you're now selecting into elementary items. > ************* > Pro*COBOL allows the use of group items in embedded SQL statements. > Group items with elementary items (containing only one level) can be > used as host variables > ************* There's where you're hitting your limitation. Since you're using the 01-level as a group-level item, you're only allowed one level below it (in your example above, the 05-level). The 10-level exceeds this. > I'm trying posting here in this group as a last effort before dumping MF > Cobol... Can anyone think of a way for me to keep my definition as is > and still be able to pre-compile? Thanks in advance for any help. If the 66-levels work, they should drop right in with no code changes at all. Of course, if you're doing something extraordinary with them, there may be tweaks needed. Anyway, best of luck. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~ / \ / ~ Live from Montgomery, AL! ~ ~ / \/ o ~ ~ ~ / /\ - | ~ LXi0007@Netscape.net ~ ~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ I do not read e-mail at the above address ~ ~ Please see website if you wish to contact me privately ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Post Follow-up to this messageValdir Jorge <vjorge@vax2.concordia.ca> wrote: > Hi! > > We are doing a proof of concept project to see what are the issues when >converting from VMS Cobol to Microfocus Cobol under Linux. One of the >problems we're facing now is that Microfocus Cobol doesn't seem to like >group names when defining a DB table. For example, we have a table >called t01_table that is defined in VMS Cobol like this: > >01 t01-table-rec. > 05 t01-prime. > 10 t01-tabno pic x(03). > 10 t01-de-key pic x(14). > 05 t01-de-char pic x(62). > 05 t01-suspend pic x(01). > 05 t01-filler pic x(30). > >When I pre-compile a program that uses this definition using Oracle's >Pro*COBOL precompiler, I get this error: > >Error at line 13, column 24 in file t01.read >select * into :t01-table-rec Your complaint is not against Micro Focus, it is against the Oracle pre-compiler, which sucks. It is also against your own source code which nev er should have said 'select *'. That's not database technlogy, that's VSAM technology. That means every time the table definition is changed, the sourc e code must be changed. Databases were supposed to get us away from that. In places I've worked as contractor, they actually did. We could make changes to databases without requiring recompilation of application programs. My advice is rewrite the Select statements to specify the columns being read and rewrite the Inserts to specify the columns inserted. That's how databases ar e supposed to work. >.......................1 >PCB-S-00208, Incorrect type for host variable "T01-PRIME" > >After some tests we have determined that the problem is that t01-prime >is a group name. If I take it out and promote the two fields below it >from level 10 to level 05, the program pre-compiles correctly. But I >cannot use this technique because it would mean a major revision of >almost one thousand programs, something we don't have the time for. >Therefore, my question is, is there a way to circumvent this problem? >Some precompilation switch that will make Microfocus Cobol accept the >group name? > >I have already posted this same question to the MicroFocus development >forum and the answers that I got indicate that MF Cobol simply doesn't >allow that. Also, the procob manual states that > >************* >Pro*COBOL allows the use of group items in embedded SQL statements. >Group items with elementary items (containing only one level) can be >used as host variables >************* > >I'm trying posting here in this group as a last effort before dumping MF >Cobol... Can anyone think of a way for me to keep my definition as is >and still be able to pre-compile? Thanks in advance for any help. > >Valdir Jorge >
Post Follow-up to this messageHi LX-i! You wrote: > how about... > 01 t01-table-rec. > 05 t01-tabno pic x(03). > 05 t01-de-key pic x(14). > [snip] > 66 t01-prime renames t01-tabno thru t01-de-key > > That way, you've still got t01-prime named, it's still alphanumeric, and > pro*cobol shouldn't gripe because you're now selecting into elementary > items. [...] Great! It works!! It will still be quite a lot of conversion work but it is much less than if I had to change my selects! Thank you very much! Valdir Jorge
Post Follow-up to this messageHi Robert! You wrote: > Your complaint is not against Micro Focus, it is against the Oracle pre-compiler, which sucks. I agree... :-( > It is also against your own source code which never should have said 'select *'.[/ color] I can't do much about that, it is a legacy system, it was designed more than twenty years ago... If I could restart from scratch, I would do it differently, of course, but total redesign is absolutely not an option for me. Valdir Jorge
Post Follow-up to this messageValdir Jorge <vjorge@vax2.concordia.ca> wrote: *'. > I can't do much about that, it is a legacy system, it was designed more >than twenty years ago... If I could restart from scratch, I would do it >differently, of course, but total redesign is absolutely not an option >for me. I just converted an AS/400 system that used the same technique. Replacing * with column names is mechanical and risk free. Future maintainers will thank you for doing it right. The AS/400 had the same limitation as Pro*Cobol -- goes down one level only. They got around it this way: 01 t01-record. 05 t01-prime. 10 pic x(03). 10 pic x(14). 05 pic x(200). 01 t01-table-rec redefines t01-record. 05 t01-tabno pic x(03). 05 t01-de-key pic x(14). 05 t01-de-char pic x(62). 05 t01-suspend pic x(01). 05 t01-filler pic x(30).
Post Follow-up to this messageValdir Jorge wrote: > Hi LX-i! > > You wrote: > > > > Great! It works!! It will still be quite a lot of conversion work > but it is much less than if I had to change my selects! Thank you very > much! Glad it helped. :) -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~ / \ / ~ Live from Montgomery, AL! ~ ~ / \/ o ~ ~ ~ / /\ - | ~ LXi0007@Netscape.net ~ ~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ I do not read e-mail at the above address ~ ~ Please see website if you wish to contact me privately ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.