Skip to main content

Hi!

I write a Cobol program with Net Express 4.0.

I Need to read a SEPA XML File with a lot of booking Details...

Now i can:

Open the XML File

Read the XML File

BUT: The file have a lot of Booking lines in the file and i can read only the first line!?
          Then i become the Information -7 (AT END) and not the next record from the file!?

Here is the Cobol Code for the XD:

       SELECT XML-STREAM  ASSIGN TO NOT LINE ADVANCING  XML-DATEINAME
                          ORGANIZATION     IS XML
                          DOCUMENT-TYPE    IS XSD-DATEINAME
                          FILE STATUS      IS FILE-STATUS-SPEC.

What is wrong with the SEPA File Details?

I use the Format "camt.053.001.02.XSD"

Have anyone an idea?

 


#XMLSEPANetExpress

Hi!

I write a Cobol program with Net Express 4.0.

I Need to read a SEPA XML File with a lot of booking Details...

Now i can:

Open the XML File

Read the XML File

BUT: The file have a lot of Booking lines in the file and i can read only the first line!?
          Then i become the Information -7 (AT END) and not the next record from the file!?

Here is the Cobol Code for the XD:

       SELECT XML-STREAM  ASSIGN TO NOT LINE ADVANCING  XML-DATEINAME
                          ORGANIZATION     IS XML
                          DOCUMENT-TYPE    IS XSD-DATEINAME
                          FILE STATUS      IS FILE-STATUS-SPEC.

What is wrong with the SEPA File Details?

I use the Format "camt.053.001.02.XSD"

Have anyone an idea?

 


#XMLSEPANetExpress

I can not really tell what is wrong using the limited information that you have provided here as you do not show the actual read statement nor the record description of the file.

I would suspect that you might be trying to read multiple elements in the file and you are not using the READ NEXT KEY IS phrase.

When using the XML preprocessor the first READ of a file without the NEXT and KEY IS phrases reads the entire file and creates an in memory representation of the file.

If you then wish to access the individual elements within this memory representation you can use the READ NEXT RECORD KEY IS element name syntax to sequentially read through the elements.

You can also use the START statement in establish a new position within the file.

Here is an example which reads multiple customer-record elements within a single xml file.

File to read:

<customerdb xsi:nonamespaceschemalocation="customers.xsd" xmlns:xsi="www.w3.org/.../XMLSchema-instance">
    <customer-record>                                                                                          
        <customer-id>00001</customer-id>
        <customer-name>George Washington</customer-name>
        <customer-address>
            <address-line-1>Mt. Vernon Estate</address-line-1>
            <address-line-2></address-line-2>
            <town-city>Mt. Vernon</town-city>
            <state-county>VA</state-county>
            <zip-postcode>22121</zip-postcode>
        </customer-address>
        <phone-number>703-780-2000</phone-number>
    </customer-record>
    <customer-record>
        <customer-id>00002</customer-id>
        <customer-name>John Adams</customer-name>
        <customer-address>
            <address-line-1>Adams Mansion</address-line-1>                                                     
            <address-line-2></address-line-2>
            <town-city>Quincy</town-city>
            <state-county>MA</state-county>
            <zip-postcode>02169</zip-postcode>
        </customer-address>                                                                                    
        <phone-number>617-773-1177</phone-number>
    </customer-record>
    <customer-record>
        <customer-id>00003</customer-id>
        <customer-name>Thomas Jefferson</customer-name>
        <customer-address>
            <address-line-1>Monticello</address-line-1>
            <address-line-2></address-line-2>
            <town-city>Charlottesville</town-city>
            <state-county>VA</state-county>
            <zip-postcode>22902</zip-postcode>
        </customer-address>
        <phone-number>434-984-9800</phone-number>
    </customer-record>
    <customer-record>
        <customer-id>00004</customer-id>
        <customer-name>James Madison</customer-name>
        <customer-address>
            <address-line-1>Montpelier</address-line-1>
            <address-line-2></address-line-2>
            <town-city>Orange</town-city>
            <state-county>VA</state-county>
            <zip-postcode>22960</zip-postcode>
        </customer-address>
        <phone-number>540-672-2728</phone-number>
    </customer-record>
</customerdb>                                                                                                  

Program to read all records:

 

      $set preprocess(prexml) endp
       id division.
       program-id.   readxml.
       environment division.
       input-output section.
       file-control.
           select customers assign to "customers.xml"
                            organization is xml
                            document-type is external "customersxml.xsd"
                            file status is xml-status.

       data division.
       file section.
       xd customers.
       01 customerdb identified by "customerdb"
          count in customerdb-count.
          05 customer-record identified by "customer-record"
             count in customer-record-count.
             10 customer-id pic X(5) identified by "customer-id"
                count in customer-id-count.
             10 customer-name pic X(50) identified by "customer-name"
                count in customer-name-count.
             10 customer-address identified by "customer-address"
                count in customer-address-count.
                15 address-line-1 pic X(50)
                   identified by "address-line-1"
                   count in address-line-1-count.
                15 address-line-2 pic X(50)
                   identified by "address-line-2"
                   count in address-line-2-count.
                15 town-city pic X(50)
                   identified by "town-city"
                   count in town-city-count.
                15 state-county pic X(50)
                   identified by "state-county"
                   count in state-county-count.
                15 zip-postcode pic X(10)
                   identified by "zip-postcode"
                   count in zip-postcode-count.
             10 phone-number pic X(15)
                identified by "phone-number"
                count in phone-number-count.
       working-storage section.
       01 xml-status    pic s9(9)  value zero.
       01 any-key       pic x      value spaces.
       procedure division.

           open input customers
           if xml-status not = 0
              display "error on open = " xml-status
              accept any-key
              stop run
           end-if

           read customers
           if xml-status < 0
              display "error on read = " xml-status
              accept any-key
              stop run
           end-if

           perform until exit
              read customers next record key is customer-record
              if xml-status not < 0
                 display "record read = "
                 display customer-record
              else
                 display "xml-status = " xml-status
                 accept any-key
                 exit perform
              end-if
           end-perform

           close customers
           stop run.


Hi!

I write a Cobol program with Net Express 4.0.

I Need to read a SEPA XML File with a lot of booking Details...

Now i can:

Open the XML File

Read the XML File

BUT: The file have a lot of Booking lines in the file and i can read only the first line!?
          Then i become the Information -7 (AT END) and not the next record from the file!?

Here is the Cobol Code for the XD:

       SELECT XML-STREAM  ASSIGN TO NOT LINE ADVANCING  XML-DATEINAME
                          ORGANIZATION     IS XML
                          DOCUMENT-TYPE    IS XSD-DATEINAME
                          FILE STATUS      IS FILE-STATUS-SPEC.

What is wrong with the SEPA File Details?

I use the Format "camt.053.001.02.XSD"

Have anyone an idea?

 


#XMLSEPANetExpress

This is not working with the SEPA XML/XSD!

Here is the XSD (only the begin of the XDS):

      01 Document identified by "Document" namespace is "urn:iso:std:iso:20022:tech:xsd:camt.053.001.02" count in Document-count.

       02 BkToCstmrStmt identified by "BkToCstmrStmt" count in BkToCstmrStmt-count.

        03 GrpHdr identified by "GrpHdr" count in GrpHdr-count.

         04 MsgId PIC X(35) identified by "MsgId" count in MsgId-count.

         04 CreDtTm PIC X(80) identified by "CreDtTm" count in CreDtTm-count.

         04 MsgRcpt identified by "MsgRcpt" count in MsgRcpt-count.

          05 Nm PIC X(140) identified by "Nm" count in Nm-count.

          05 PstlAdr identified by "PstlAdr" count in PstlAdr-count.

           06 AdrTp identified by "AdrTp" count in AdrTp-count.

            88 enumerator-0 value is "ADDR".

            88 enumerator-1 value is "PBOX".

            88 enumerator-2 value is "HOME".

            88 enumerator-3 value is "BIZZ".

            88 enumerator-4 value is "MLTO".

            88 enumerator-5 value is "DLVY".

            07 AdrTp-value PIC X(80).

           06 Dept PIC X(70) identified by "Dept" count in Dept-count.

           06 SubDept PIC X(70) identified by "SubDept" count in SubDept-count.

           06 StrtNm PIC X(70) identified by "StrtNm" count in StrtNm-count.

           06 BldgNb PIC X(16) identified by "BldgNb" count in  BldgNb-count.

           06 PstCd PIC X(16) identified by "PstCd" count in PstCd-count.

           06 TwnNm PIC X(35) identified by "TwnNm" count in TwnNm-count.

           06 CtrySubDvsn PIC X(35) identified by "CtrySubDvsn" count in CtrySubDvsn-count.

           06 Ctry PIC X(80) identified by "Ctry" count in Ctry-count.

           06 AdrLine PIC X(70) occurs 7 times identified by "AdrLine" count in AdrLine-count.

          05 Id0 identified by "Id" count in Id0-count.

           06 OrgId identified by "OrgId" count in OrgId-count.

            07 BICOrBEI PIC X(80) identified by "BICOrBEI" count in

               BICOrBEI-count.

            07 Othr identified by "Othr" count in Othr-count.

             08 Id01 PIC X(35) identified by "Id" count in Id01-count.

             08 SchmeNm identified by "SchmeNm" count in SchmeNm-count.

              09 Cdx PIC X(4) identified by "Cd" count in Cd-count.

              09 Prtry PIC X(35) identified by "Prtry" count in

                 Prtry-count.

             08 Issr PIC X(35) identified by "Issr" count in

                Issr-count.

           06 PrvtId identified by "PrvtId" count in PrvtId-count.

            07 DtAndPlcOfBirth identified by "DtAndPlcOfBirth" count in

                DtAndPlcOfBirth-count.

             08 BirthDt PIC X(80) identified by "BirthDt" count in

                BirthDt-count.

             08 PrvcOfBirth PIC X(35) identified by "PrvcOfBirth" count

                 in PrvcOfBirth-count.

             08 CityOfBirth PIC X(35) identified by "CityOfBirth" count

                 in CityOfBirth-count.

             08 CtryOfBirth PIC X(80) identified by "CtryOfBirth" count

                 in CtryOfBirth-count.

            07 Othr identified by "Othr" count in Othr-count.

             08 Id02 PIC X(35) identified by "Id" count in Id02-count.

             08 SchmeNm identified by "SchmeNm" count in SchmeNm-count.

              09 Cdx PIC X(4) identified by "Cd" count in Cd-count.

              09 Prtry PIC X(35) identified by "Prtry" count in

                 Prtry-count.

             08 Issr PIC X(35) identified by "Issr" count in

                Issr-count.

          05 CtryOfRes PIC X(80) identified by "CtryOfRes" count in

             CtryOfRes-count.

          05 CtctDtls identified by "CtctDtls" count in CtctDtls-count.

           06 NmPrfx identified by "NmPrfx" count in NmPrfx-count.

            88 enumerator-0 value is "DOCT".

            88 enumerator-1 value is "MIST".

            88 enumerator-2 value is "MISS".

            88 enumerator-3 value is "MADM".

            07 NmPrfx-value PIC X(80).

           06 Nm PIC X(140) identified by "Nm" count in Nm-count.

           06 PhneNb PIC X(80) identified by "PhneNb" count in

              PhneNb-count.

           06 MobNb PIC X(80) identified by "MobNb" count in

              MobNb-count.

           06 FaxNb PIC X(80) identified by "FaxNb" count in

              FaxNb-count.

           06 EmailAdr PIC X(2048) identified by "EmailAdr" count in

              EmailAdr-count.

           06 Othr PIC X(35) identified by "Othr" count in Othr-count.

         04 MsgPgntn identified by "MsgPgntn" count in MsgPgntn-count.

          05 PgNb PIC X(80) identified by "PgNb" count in PgNb-count.

          05 LastPgInd PIC X(80) identified by "LastPgInd" count in

             LastPgInd-count.

         04 AddtlInf PIC X(500) identified by "AddtlInf" count in

            AddtlInf-count.

And here is the read:

          OPEN INPUT XML-STREAM.

          READ XML-STREAM.

          PERFORM UNTIL EXIT

              IF  FILE-STATUS-SPEC < 0

                  EXIT PERFORM

              END-IF

              ADD  1        TO XML-ZAEHLER

              MOVE Document TO CBL-Document

              IF  XML-ZAEHLER = 1

                  PERFORM CSV-KOPF-ZEILE-ERSTELLEN

              END-IF

              PERFORM CSV-ZEILE-AUFBAUEN

              READ XML-STREAM NEXT RECORD KEY IS  BKTOCSTMRSTMT

          END-PERFORM.

          CLOSE XML-STREAM.


Hi!

I write a Cobol program with Net Express 4.0.

I Need to read a SEPA XML File with a lot of booking Details...

Now i can:

Open the XML File

Read the XML File

BUT: The file have a lot of Booking lines in the file and i can read only the first line!?
          Then i become the Information -7 (AT END) and not the next record from the file!?

Here is the Cobol Code for the XD:

       SELECT XML-STREAM  ASSIGN TO NOT LINE ADVANCING  XML-DATEINAME
                          ORGANIZATION     IS XML
                          DOCUMENT-TYPE    IS XSD-DATEINAME
                          FILE STATUS      IS FILE-STATUS-SPEC.

What is wrong with the SEPA File Details?

I use the Format "camt.053.001.02.XSD"

Have anyone an idea?

 


#XMLSEPANetExpress

This is not working with the SEPA XML/XSD!

Here is the XSD (only the begin of the XDS):

      01 Document identified by "Document" namespace is "urn:iso:std:iso:20022:tech:xsd:camt.053.001.02" count in Document-count.

       02 BkToCstmrStmt identified by "BkToCstmrStmt" count in BkToCstmrStmt-count.

        03 GrpHdr identified by "GrpHdr" count in GrpHdr-count.

         04 MsgId PIC X(35) identified by "MsgId" count in MsgId-count.

         04 CreDtTm PIC X(80) identified by "CreDtTm" count in CreDtTm-count.

         04 MsgRcpt identified by "MsgRcpt" count in MsgRcpt-count.

          05 Nm PIC X(140) identified by "Nm" count in Nm-count.

          05 PstlAdr identified by "PstlAdr" count in PstlAdr-count.

           06 AdrTp identified by "AdrTp" count in AdrTp-count.

            88 enumerator-0 value is "ADDR".

            88 enumerator-1 value is "PBOX".

            88 enumerator-2 value is "HOME".

            88 enumerator-3 value is "BIZZ".

            88 enumerator-4 value is "MLTO".

            88 enumerator-5 value is "DLVY".

            07 AdrTp-value PIC X(80).

           06 Dept PIC X(70) identified by "Dept" count in Dept-count.

           06 SubDept PIC X(70) identified by "SubDept" count in SubDept-count.

           06 StrtNm PIC X(70) identified by "StrtNm" count in StrtNm-count.

           06 BldgNb PIC X(16) identified by "BldgNb" count in  BldgNb-count.

           06 PstCd PIC X(16) identified by "PstCd" count in PstCd-count.

           06 TwnNm PIC X(35) identified by "TwnNm" count in TwnNm-count.

           06 CtrySubDvsn PIC X(35) identified by "CtrySubDvsn" count in CtrySubDvsn-count.

           06 Ctry PIC X(80) identified by "Ctry" count in Ctry-count.

           06 AdrLine PIC X(70) occurs 7 times identified by "AdrLine" count in AdrLine-count.

          05 Id0 identified by "Id" count in Id0-count.

           06 OrgId identified by "OrgId" count in OrgId-count.

            07 BICOrBEI PIC X(80) identified by "BICOrBEI" count in

               BICOrBEI-count.

            07 Othr identified by "Othr" count in Othr-count.

             08 Id01 PIC X(35) identified by "Id" count in Id01-count.

             08 SchmeNm identified by "SchmeNm" count in SchmeNm-count.

              09 Cdx PIC X(4) identified by "Cd" count in Cd-count.

              09 Prtry PIC X(35) identified by "Prtry" count in

                 Prtry-count.

             08 Issr PIC X(35) identified by "Issr" count in

                Issr-count.

           06 PrvtId identified by "PrvtId" count in PrvtId-count.

            07 DtAndPlcOfBirth identified by "DtAndPlcOfBirth" count in

                DtAndPlcOfBirth-count.

             08 BirthDt PIC X(80) identified by "BirthDt" count in

                BirthDt-count.

             08 PrvcOfBirth PIC X(35) identified by "PrvcOfBirth" count

                 in PrvcOfBirth-count.

             08 CityOfBirth PIC X(35) identified by "CityOfBirth" count

                 in CityOfBirth-count.

             08 CtryOfBirth PIC X(80) identified by "CtryOfBirth" count

                 in CtryOfBirth-count.

            07 Othr identified by "Othr" count in Othr-count.

             08 Id02 PIC X(35) identified by "Id" count in Id02-count.

             08 SchmeNm identified by "SchmeNm" count in SchmeNm-count.

              09 Cdx PIC X(4) identified by "Cd" count in Cd-count.

              09 Prtry PIC X(35) identified by "Prtry" count in

                 Prtry-count.

             08 Issr PIC X(35) identified by "Issr" count in

                Issr-count.

          05 CtryOfRes PIC X(80) identified by "CtryOfRes" count in

             CtryOfRes-count.

          05 CtctDtls identified by "CtctDtls" count in CtctDtls-count.

           06 NmPrfx identified by "NmPrfx" count in NmPrfx-count.

            88 enumerator-0 value is "DOCT".

            88 enumerator-1 value is "MIST".

            88 enumerator-2 value is "MISS".

            88 enumerator-3 value is "MADM".

            07 NmPrfx-value PIC X(80).

           06 Nm PIC X(140) identified by "Nm" count in Nm-count.

           06 PhneNb PIC X(80) identified by "PhneNb" count in

              PhneNb-count.

           06 MobNb PIC X(80) identified by "MobNb" count in

              MobNb-count.

           06 FaxNb PIC X(80) identified by "FaxNb" count in

              FaxNb-count.

           06 EmailAdr PIC X(2048) identified by "EmailAdr" count in

              EmailAdr-count.

           06 Othr PIC X(35) identified by "Othr" count in Othr-count.

         04 MsgPgntn identified by "MsgPgntn" count in MsgPgntn-count.

          05 PgNb PIC X(80) identified by "PgNb" count in PgNb-count.

          05 LastPgInd PIC X(80) identified by "LastPgInd" count in

             LastPgInd-count.

         04 AddtlInf PIC X(500) identified by "AddtlInf" count in

            AddtlInf-count.

And here is the read:

          OPEN INPUT XML-STREAM.

          READ XML-STREAM.

          PERFORM UNTIL EXIT

              IF  FILE-STATUS-SPEC < 0

                  EXIT PERFORM

              END-IF

              ADD  1        TO XML-ZAEHLER

              MOVE Document TO CBL-Document

              IF  XML-ZAEHLER = 1

                  PERFORM CSV-KOPF-ZEILE-ERSTELLEN

              END-IF

              PERFORM CSV-ZEILE-AUFBAUEN

              READ XML-STREAM NEXT RECORD KEY IS  BKTOCSTMRSTMT

          END-PERFORM.

          CLOSE XML-STREAM.


Hi!

I write a Cobol program with Net Express 4.0.

I Need to read a SEPA XML File with a lot of booking Details...

Now i can:

Open the XML File

Read the XML File

BUT: The file have a lot of Booking lines in the file and i can read only the first line!?
          Then i become the Information -7 (AT END) and not the next record from the file!?

Here is the Cobol Code for the XD:

       SELECT XML-STREAM  ASSIGN TO NOT LINE ADVANCING  XML-DATEINAME
                          ORGANIZATION     IS XML
                          DOCUMENT-TYPE    IS XSD-DATEINAME
                          FILE STATUS      IS FILE-STATUS-SPEC.

What is wrong with the SEPA File Details?

I use the Format "camt.053.001.02.XSD"

Have anyone an idea?

 


#XMLSEPANetExpress

I tested this here by downloading the camt.053.001.02.xsd and converting it to a COBOL copybook using the CBL2XML tool in Net Express.

I found a sample .xml file as well and replicated the records so that I had more than one to test with.

I can read multiple occurrences of the BKTOCSTMRSTMT key but I have to start the file on that key before I do the first READ NEXT.

Try the following:

         OPEN INPUT XML-STREAM.

         READ XML-STREAM.

         START XML-STREAM KEY IS BKTOCSTMRSTMT

         PERFORM UNTIL EXIT

         ...

I am testing with Net Express 5.1.

Thanks.