Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Web Services and COBOL (Fairly long post, but I don't have time
Rene_Surop wrote:
> Quite interesting.
>
> Web Service is a great prerequisite for automated client-side code
> generation in the mainstream Java and .NET SOAP frameworks. It's a
> multi-language technology tool really, it could be C#, Cobol, Java.
>
> Just wonderin', is there anyone who could provide NetExpress Cobol
> code (Microfocus) similar above??
>
Rene,

I could say 'Do your own bloody homework !" :-)

Can't remember do you only have N/E 3.1 or do you also have V 5.0 ?
If you have V 5.0 then I think the source should compile - whether yours
works or not, that's another matter.

If you are still back at N/E V 3.1 then you have problems. You will
probably need to use the ISO 2000 directive like I've shown as the first
line of the source below. You might also need Repository directives -
but I keep getting syntax errors. If you read up on Directives for
2000/Repository, although you can simulate the *intended* COBOL 2000
(ha, ha, bloody ha !), it doesn't do any conformance checking in N/E 3.1.

I've dickered around with Pete's source and at this point in time there
are only three compiler errors :-

1 - doesn't like where I've placed my substitute Class-Control entry
2 - doesn't like Line 210 - but that's associated with # 1
3 - Line 642 doesn't recognize invoke COM - again back to #1 above ?

If you try other permutations I anticipate you will get a slightly
different set of errors.

I don't know if you can get it working without Repository syntax - I
doubt it - just have to suck and see. Anyway as is, the source is just
down to three errors. So now you can take over :-) - you can zip me back
a copy if you get it working with N/E 3.1 - no point if you only do it
with N/E 5.0. (If for some unknown reason the source below wraps around,
e-mail me and I'll send the N/E source file as a zip).

Note for Pete - what you transmitted - a bit of a pain in the butt, but
not your intent :-). First I highlighted and pasted and each line was
preceded by '>'. Then the problem with the wrap around comments.
Probably OK if you were passing a source zipped file, but these damned
e-mail programs aren't that clever. (My own style just using Columns 8
thru 72 I enter '*>' in columns 8 and 9 - that allows me to highlight (
1 thru 72) and paste without wrap-arounds).

EDITED SOURCE :

$set iso2000

*> This 'PARTIAL' version for Net Express V 3.1


000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. 'SOAPTest'.
000030*AUTHOR. Peter E. C. Dashwood.
000031*
000040* This program attempts to instantiate a SOAP Proxy class and
000050* access a Web Service using the new proxy...
000051*
000060*DATE_WRITTEN. May 2007.
000070 ENVIRONMENT DIVISION.
000080 configuration section.
000090 source-computer. IBM-PC.
000100 object-computer. IBM-PC.

Class-Control.       COM Class is  "*com".

*      Three possibilities for Repository Directive, kept on getting
*      errors 'Can't use here' :-

*     $set Repository Off
*     $set Repository Update
*     $set Repository Checking


000101 *>REPOSITORY.
000110 *>    CLASS COM AS "*COM".
000120
000170
000200*------------------------  DATA   DIVISION  ---------------------
000210 DATA DIVISION.
000340*
000350 WORKING-STORAGE SECTION.
000360 01  in-interface-block pic x(8197).
000361 01  in-IB.
000362     12 in-ws-return   pic x(5).
000363        88 in-ws-OK   value '00000'. *> will contain SQKSTATE if
000364                                 *> there is a DB error
000365     12 in-ws-message  pic x(256). *> will contain SQLMSG if
000366                                 *> there is a DB error
000367     12 in-ws-buffer   pic x(2048). *> holds free format address
data
000368                                  *> this will be formatted on
return
000369     12 in-ws-breakdown.
000370        15 in-ws-streetNo             pic x(20).
000371        15 in-ws-POBoxNo              pic x(15).
000372        15 in-ws-RDNo                 pic x(8).
000373        15 in-ws-street               pic x(150).
000374        15 in-ws-locality             pic x(150).
000375        15 in-ws-city                 pic x(50).
000376        15 in-ws-lobby                pic x(150).
000377        15 in-ws-postCode             pic x(4).
000378        15 in-ws-addressType          pic x(1).
000379        15 in-ws-streetSDX            pic x(4).
000380        15 in-ws-localitySDX          pic x(4).
000381        15 in-ws-lobbySDX             pic x(4).
000382        15 in-ws-prologue             pic x(100).
000383     12 in-ws-interface               pic x.
000384           88 in-free-format-input     value '1'.
000385           88 fixed-field-input        value '2'.
000386           88 XML-input                value '3'.
000387     12 in-ws-streetMatchFlag         pic x(1).
000388           88 street-fuzzy                  value '0'.
000389           88 street-exact                  value '1'.
000390     12 in-ws-localityMatchFlag       pic x(1).
000391           88 locality-fuzzy                  value '0'.
000392           88 locality-exact                  value '1'.
000393     12 in-ws-repeatLocalityFlag      pic x(1).
000394           88 no-Locality                  value '1'.
000395           88 repeatLocality  value '0'.
*> used if Locality =  City
000396     12 in-ws-ignoreInvalidPostcode   pic x(1).
000397           88 ignoreInvalidPostCode        value '1'.
000398           88 reportInvalidPostCode        value '0'.
*>stops if Post Code is invalid
000399     12 in-ws-foreignFlag             pic x(1).
000400           88 foreign-address            value '1'.
*>stops if foreign address detected
000401           88 NOT-foreign-address        value '0'.
000402
000403 01  out-interface-block pic x(8197).
000405 01  out-IB.
000406
000407     12 out-ws-return   pic x(5).
000408        88 out-ws-OK            value '00000'.
*> will contain SQLSTATE if
000409                                 *> there is a DB error
000410     12 out-ws-message  pic x(256). *> will contain SQLMSG if
000411                                 *> there is a DB error
000412     12 out-ws-buffer   pic x(2048).
*> holds free format address data
000413                               *> this will be formatted on return
000414     12 out-ws-breakdown.
000415        15 out-ws-streetNo             pic x(20).
000416        15 out-ws-POBoxNo              pic x(15).
000417        15 out-ws-RDNo                 pic x(8).
000418        15 out-ws-street               pic x(150).
000419        15 out-ws-locality             pic x(150).
000420        15 out-ws-city                 pic x(50).
000421        15 out-ws-lobby                pic x(150).
000422        15 out-ws-postCode             pic x(4).
000423        15 out-ws-addressType          pic x(1).
000424        15 out-ws-streetSDX            pic x(4).
000425        15 out-ws-localitySDX          pic x(4).
000426        15 out-ws-lobbySDX             pic x(4).
000427        15 out-ws-prologue             pic x(100).
000428     12 out-ws-interface               pic x.
000429           88 free-format-input        value '1'.
000430           88 fixed-field-input        value '2'.
000431           88 XML-input                value '3'.
000432     12 out-ws-streetMatchFlag         pic x(1).
000433           88 street-fuzzy                  value '0'.
000434           88 street-exact                  value '1'.
000435     12 out-ws-localityMatchFlag       pic x(1).
000436           88 locality-fuzzy                  value '0'.
000437           88 locality-exact                  value '1'.
000438     12 out-ws-repeatLocalityFlag      pic x(1).
000439           88 no-Locality                  value '1'.
000440           88 repeatLocality               value '0'.
*> used if Locality = City
000441     12 out-ws-ignoreInvalidPostcode   pic x(1).
000442           88 ignoreInvalidPostCode        value '1'.
000443           88 reportInvalidPostCode        value '0'.
*> stops if Post Code is invalid
000444     12 out-ws-foreignFlag             pic x(1).
000445           88 foreign-address            value '1'.
*>stops if foreign address detected
000446           88 NOT-foreign-address        value '0'.
000447
000448
000449 01  WSDL-reference pic x(80) value
000450* WSDL to connect to the remote host (in San Francisco)
'http://primacomputing.co.nz/AVSWebService/AVSWebService.asmx?WSD
-'L'.
000451

000452* WSDL to connect to my IIS server on my new VAIO notebook
* machine over wireless LAN.
000453*     'http://bigblack/AVSWebService/AVSWebService.asmx?WSDL'.
000454*
000455* I have tested both of the above and they both work perfectly.
* Web services can
000456* be hosted anywhere you like and accessed from anywhere on Earth.
* It's magic...!!
000457* (Like DCOM+ on steroids...)
000458
000459 01  COMServer-ProgIDs.
000460     12 SOAP-ProgID           pic x(19) value
000461     "MSSOAP.SoapClient30".
000462
000463 01  COMServer-Objects.
000464     12 objSOAPClient    OBJECT REFERENCE. *> COM.
000465
000466 01  subscripts usage comp-5.
000467     12 J                     pic s9(5).
000468     12 K                     pic s9(5).
000469
000470 01  end-flag                    pic x.
000471     88 not-finished             value zero.
000472     88 finished                 value '1'.
000473
000487
000490 PROCEDURE DIVISION.
000500 MAIN SECTION.
000510 a000.
000520     perform startup-housekeeping
000530     perform main-logic until finished
000540     perform close-down
000550     .
000560 a999.
000570     stop run.
000580*-----------------------------------------------------------
000590 STARTUP-HOUSEKEEPING            section.
000600 sh000.
000640     set not-finished to TRUE
000641* Instantiate SOAP COM Server...
000642     invoke COM "CREATE-OBJECT" using SOAP-ProgID
000643                                returning objSOAPClient
000644     end-invoke
000645* Initialize the SOAP Server and point it at the WSDL for the Web
* Service
000646     invoke objSOAPClient "mssoapinit"
000647            using WSDL-reference
000648     end-invoke
000649* At this point the objSOAPClient reference has become a proxy for
* the AVS Web Service...
000650* This means you can reference any of the methods/properties/events
* exposed by the Web Service,
000651* as if they belonged to the objSOAPClient object...
000652     .
000660 sh999.
000670     exit.
000680*-----------------------------------------------------------
000690 MAIN-LOGIC                      section.
000700 ml000.
000701*
000707*
000708* Now try the methods...
000709*
000710* The AVS Web Service only exposes one method, but the underlying
* COM object has several.
000711
000712* Set up an address string... (Not essential... if you
000714* pass a blank interface block to AVS it will return a message in
* the ws-message
000715* area telling you it was invalid...)
000716     move spaces to in-IB
000718     set in-free-format-input to TRUE
000719     move '97 21ST AVE TAURANGA' to in-ws-buffer *> A NZ address...
000720     move in-IB to in-interface-block
000721     *> Note that string parameters to COM objects must be 8197
bytes
000722     *> and must be elemental.
000723
000724  invoke objSOAPClient "ValidateNZaddress"
000725    using in-interface-block      *> input interface block
000726    returning out-interface-block *> output interface block
000727    *> Note that you could use just one block
000728    *> but you must reference it in and out because the
000729    *> Web Service expects in and out parameters                  n
000730
000731     end-invoke
000732*========================== SOAP XML Stringing error fix
000733* There is currently a problem with SOAP stripping out certain
* characters
000734* in the returned string. This causes fields to be aligned
* incorrectly. The
000735* following is a quick fix and won't be required once the service
*  is released.
000736*
000737     move 1 to K *> output buffer pointer
000746    perform
000756        varying J *> input buffer pointer (for this process)
000757           from 1
000758             by 1
000759          until K > function LENGTH (out-IB)
000760             move out-interface-block (J:1) to out-IB (K:1)
000761             add 1 to K
000762             if out-interface-block (J:1) = x'0A'
000763                move space to out-IB (K:1)
000764                add 1 to K
000765             end-if
000766     end-perform
000769
000770*
000771* ALL of the above code would be replaced by:
000772*
000773*    move out-interface-block to out-IB
000774*
000775* ...once the COM server and SOAP wrapper are fixed. (I'm working
* on it... :-))
000776*
000777*============  End of SOAP XML Stringing error fix ===========
000778*
000779
000780*  Debugging Note
000781*
000782*  Now is a good time to look at out-ws-breakdown and
*  out-ws-buffer...
000783*
000784* If you are stepping through this in the debugger, note that each
* field has been
000785* filled in, (street number, street, locality, region, and postcode)
* and the
000786* ws-buffer area now contains a properly formatted address which
* complies with
000787* NZPO requirements, and has been converted to mixed case.
000788*
000789     set finished to TRUE
000790
000791     .
001210 ml999.
001220     exit.
001230*----------------------------------------------------------
001240 CLOSE-DOWN                      section.
001250 cd000.
001260     set objSOAPClient to NULL *> Help the garbage collector ...
001340     .
001350 cd999.
001360     exit.
001370*----------------    END OF PROGRAM 'SOAPTEST' ----------------

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
05-22-07 08:55 AM


Re: Web Services and COBOL (Fairly long post, but I don't have time
Rene_Surop wrote: 
>
>
> Haha.... was expecting that, well it is suppose to be a quote from
> "docdwarf" :-)
>
> Yap, you're right I'm still in N/E 3.1
>
> Though I was given NetExpress with .NET evaluation copy, I didn't
> really used it that much because MF suddenly released N/E 4.0.... and
> to V5.0. Hoping I could have a copy of it. But until then, I am
> preoccupied viewing their demo on Interface Mapping Toolkit.
>

Hang tight. See Pete's comments. Based on his observations I'll give it
a go in N/E 3.1 and get back to you both.

Jimmy

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
05-23-07 02:55 AM


Re: Web Services and COBOL (Fairly long post, but I don't have time
By George he's got it ! I think :-). Cut a long story short, I initially
downloaded SOAP but doing that Registry check found I already had it.
Whether or not that duplication was causing a problem ....???? Anyway
deleted second.

I keep on saying I code, (or used to code)  in Classes so I have
difficulty getting Procedurals to do exactly what I want without a lot
of buggering around. Example : I used '$set sourceformt "free"' and for
some inexplicable reason the compiler queried your line numbers. I had
other irritating problems as well. So sod it. Use what you are
comfortable with. I went with the Class format - same as you did but now
your paragraphs become methods. Here goes :-

Give it a shot Rene and confirm that it works for you !

The code for both starts in Column 8 -

*>----------------- soaptrigger.cbl ----------------------------

*> Trigger PROCEDURAL program used here. Assume Soaptest was
*> selected from a Mster Menu - then the Menu would invoke in a
*> similar manner.

Program-id.         SoapTrigger.

Class-Control.      SoapTest is class "soaptest".

WORKING-STORAGE SECTION.
01 os-SoapTest             object reference value null.

PROCEDURE DIVISION.

invoke SoapTest    "new"      returning os-SoapTest
invoke os-SoapTest "begin"
invoke os-Soaptest "finalize" returning os-SoapTest

*> Strictly speaking the 'finalize' above is not required -
*> it is replaced by the STOP RUN

STOP RUN.

*>--------------------------------------------------------------


*>-----------------soaptest.cbl ------------------------------
$set sourceformat"free"
$set ooctrl(+p)
*>------------------------------------------------------------

*> Original Procedural program written by Peter E.C. Dashwood
*> in May 2007 using Fujitsu dotNetCOBOL invoking Soap

*> This class adapated by James J. Gavan for Net Express V 3.1.
*> If using later versions of Net Express then REPOSITORY syntax
*> can replace the 'Class-Control' entries below

*>---------------------------------------------------------------
Class-id.        Soaptest.
*>               Soaptest inherits from Base.

*> Where no inheritance is specified it defaults to Base

Class-Control.  *> olebase          is class "olebase"
oleexceptionmanager is class "oleexpt"
Soaptest            is class "soaptest"
Mssoap              is class "$OLE$MSSOAP.SoapClient30"

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
05-24-07 08:55 AM


Re: Web Services and COBOL (Fairly long post, but I don't have time
Pete Dashwood wrote:
> Round of applause!!!
>
> Really good stuff, Jimmy.
>
> Some comments below...
>

> Not sure how you are using "Procedural" here.Maybe MF have a specific
> meaning for it.

Well you might not like it, but I would call your source 'Procedural' in
that it is a PROGRAM source as opposed to a CLASS source, although you
are still creating/accessing objects via invokes. I think the advantage
of ALL classes is the ability to do a 'round robin' between the various
classes because you can have an instance handle (object reference) to
each. (My comment was not based on Micro Focus - they are silent on the
topic).
>
> I like what you did very much. I have reservations about trigger programs
> but it works very well here.
>
Well of course the early M/F OO examples all did/and still have a
Trigger program. The main functions are :-

- Menu driven application - from the Trigger start the App(Business
Logic) and the Master Menu. Return handles from both to the Trigger
which passes them to the corresponding App and Menu instances

- call "apigui" which kick starts GUIing

This is the trigger for the Corrosion Testing application, which
illustrates above :-

*>--------------------ctbegin.cbl--------------------------

PROGRAM-ID.       ctbegin.

CLASS-CONTROL.    ctApplication      is class "ctapp"
ctMenu             is class "ctmenu"
EventManager       is class "p2emgr"
Module             is class "module"

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
05-24-07 11:55 PM


Re: Web Services and COBOL (Fairly long post, but I don't have time
Pete Dashwood wrote:

Just in case you are itching to know runtimes based on following as
modified, plus I also used your 'good address' :-

*>----------------- soaptrigger.cbl ----------------------------

*> Trigger PROCEDURAL program used here. Assume Soaptest was
*> selected from a Mster Menu - then the Menu would invoke in a
*> similar manner.

Program-id.         SoapTrigger.

Class-Control.      SoapTest        is class "soaptest"
DateAndTime     is class "datetime"

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
05-25-07 02:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:51 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.