Monday, June 14, 2010

Cobol on the Bus - Cobol Copybooks & Oracle Service Bus 11g Part 1

I'm back doing some work on Oracle OSB11g - preparing a POC showing integration with Cobol Copybooks.I actually began my IT life programming Cobol on Honeywell DPS8 for the Irish Revenue Commissioners so it was a bit deja vu for me. For those post-Cobol baby boomers here's an example of such a cobol copybook -


000100 01 PERSON.

000200 05 PERSON-FIRST-NAME PIC X(10).

000300 05 PERSON-LAST-NAME PIC X(10).

000400 05 PERSON-COUNTRY PIC X(02).

000500 05 REQUEST-TYPE PIC X(01).


save the above to a file with the extension .cpy e.g. person.cpy

This is a very simple person definition - X --> alpha.

In this scenario we receive a message that adheres to the definition in the Cobol Copybook.If it is of request type "C" (Create) we will route to the create operation of the Person business service.If it is of request type "U" (Update) we will route to the update operation of the Person business service.If it is of request type "D" (Delete) we will route to the delete operation of the Person business service. We will now implement what will be our OSB Business Service.


Create Person Web Service

In JDev simply create a Java class that implements 3 methods -

createPerson(String name)
updatePerson(String name)
deletePerson(String name)



Create a new App server connection






Expose as a web service and deploy to the WLS instance running OSB.




Test the web service via the WLS console e.g. localhost:7021/console --> deployments --> test etc.



Create an OSB project with the following folder structure -





Create a new MFL in the MFL folder -






Double click on the newly created file to start Format Builder.
Import Cobol Copybook...



Specify your person.cpy file








Specify delimiter we will use carraige return \n




Test the MFL








Note the HEX 0a has been added for carriage return






Save this input file for use in later testing.










2 comments:

Anonymous said...

Hi Experts,

When i was trying to import .cpy file by using MFL it is giving an error like
D:\HCR1.cpy: 1: error: Improper level number '0'; 01 assumed
D:\HCR1.cpy: 1: error: Expected an identifier or FILLER, found ':'
D:\HCR1.cpy: 1: error: Recovering, skipping to next '.'
D:\HCR1.cpy, Lines: 79, Errors: 4, Warnings: 0

what would be the Solution... Please let me know it helps me a lot...

Thanks in advance
Uday

uday said...

Hi Experts,

When i was trying to import .cpy file by using MFL "COBOL Copybook importer " and i have selected the options with "Big Indian and EBCDICit is giving an error like
D:\HCR1.cpy: 1: error: Improper level number '0'; 01 assumed
D:\HCR1.cpy: 1: error: Expected an identifier or FILLER, found ':'
D:\HCR1.cpy: 1: error: Recovering, skipping to next '.'
D:\HCR1.cpy, Lines: 79, Errors: 4, Warnings: 0

what would be the issue... Please let me know it helps me a lot...

Thanks in advance
Uday shankar