在一个工作的cobol程序JCS00008.cob(最后附件)中,我有一些自定义宏调用(例如& AQENVIAR,& AQERROR和& AQERRORV)。 我在statment& AQENVIAR(第323,359,416行)上收到解析错误,如下所示:
ERROR c.s.cobol.squid.CobolAstScanner - Unable to parse COBOL source file : C:\sonar-test\JCS00008.cob at line 323
...
...
Parse error at line 323:
318: NUM-CONDICION-ADICIONAL OF TC07002I
319: MOVE '0001' TO COD-EMPRESA OF TC07002I
320: MOVE WKS-SPORTELL TO COD-CENTRO OF TC07002I .
321: MOVE SPACES TO NOMBRE OF TC07002I .
322: MOVE SPACES TO COD-TIPO-CENTRO OF TC07002I .
323: & AQENVIAR ( TCS07002 INPUT-TXN-TCS07002
^
324: OUTPUT-TXN-TCS07002 ERROR-AREA )
做一些修改cobol文件的试验,它接收我也没有得到同样错误的原因& AQERROR和& AQERRORV(在第267,303,333,366,389行)是因为那些宏包含在if / else语句中。
环境:
这里整个cobol程序JCS00008.cob:
****************************************************************
** **
** BNL IT 2001 **
** **
** **
****************************************************************
** **
** MODULE NAME: XXXXXXXX **
** **
** DATE GENERATED: XXXXXX XX/XX/XXXX **
** **
** BY USER: **
** **
** DESIGNER: **
** **
** PROGRAMMER: **
** **
** **
** DESCRIPTION **
** **
** **
** **
****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. JCS00008.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
****************************************************************
** VARIABILI DI ARCHITETTURA **
****************************************************************
01 AH-VARIABLES.
05 AH-PROGRAMA-PREVIO PIC X(8).
05 AH-LONGITUD-PREVIA PIC S9(9) COMP-3.
05 FILLER PIC 9 VALUE 0.
88 AH-ERROR-SERVI-CONTROL-ARQ VALUE 0.
88 AH-ERROR-SERVI-CONTROL-APL VALUE 1.
01 FND-SEVERITY-OK PIC S9(4) COMP VALUE 0.
01 FND-SEVERITY-WARNING PIC S9(4) COMP VALUE 4.
01 FND-SEVERITY-ERROR PIC S9(4) COMP VALUE 8.
01 FND-SEVERITY-FATAL PIC S9(4) COMP VALUE 16.
01 LOG-APPL-DATA PIC X(80) VALUE SPACES.
***
****************************************************************
** COPY ERRORI ARCHITETTURA **
****************************************************************
*
COPY AHNUMERR.
*
****************************************************************
** COPY DI ERRORE DB2 **
****************************************************************
*
*COPY ERRSQLCO.
* EXEC SQL
* INCLUDE SQLCA
* END-EXEC.
*
****************************************************************
** COPY DEL PROGRAMMATORE **
****************************************************************
COPY JCG01RC.
*
****************************************************************
** VARIABILI DEL PROGRAMMATORE **
****************************************************************
01 JCZRIC3T PIC X(8) VALUE 'JCZRIC3T'.
01 NKS17272 PIC X(8) VALUE 'NKS17272'.
01 TCS07002 PIC X(8) VALUE 'TCS07002'.
01 TCS08002 PIC X(8) VALUE 'TCS08002'.
01 IND PIC 9(3) COMP-3 VALUE 0.
01 WKS-CONTO PIC X(6).
01 WKS-SPORTELL PIC X(4).
*
01 WS-NUM-ERR PIC S9(8) COMP VALUE 0.
*
* AREA RELATIVA ALLA GESTIONE DEGLI ERRORI 02100000
COPY NXERR01. 02110000
*
01 INPUT-TXN-NK17272.
COPY NK17272I.
01 OUTPUT-TXN-NK17272.
COPY NK17272O.
**** COPY AREA I/O COMPONENTE 'ESISTENZA SPORTELLO'
01 INPUT-TXN-TCS07002.
COPY TC07002I.
01 OUTPUT-TXN-TCS07002.
COPY TC07002O.
**** COPY AREA I/O COMPONENTE 'AREA TERRITORIALE'
01 INPUT-TXN-TCS08002.
COPY TC08002I.
01 OUTPUT-TXN-TCS08002.
COPY TC08002O.
****************************************************************
** LITERAL DEL PROGRAMMATORE **
****************************************************************
01 LT-CONSTANT.
05 LT-TRUE PIC 9 VALUE 1.
***********************************************************
* INSERIRE IL NOME DEL PROGRAMMA PRESENTE NELLA PROGRAM-ID*
***********************************************************
05 LT-PROGRAM-NAME PIC X(08) VALUE 'JCS00008'.
*
****************************************************************
** INCLUDE TABELLE DB2 **
****************************************************************
*
LINKAGE SECTION.
*
01 DFHCOMMAREA PIC X.
01 DFHEIBLK PIC X.
*
****************************************************************
** AREA DE CONTEXTO **
****************************************************************
01 CONTEXT-AREA.
COPY AHCONTEX.
****************************************************************
** INPUT AND OUTPUT MESSAGE DATA **
****************************************************************
01 INPUT-TXN.
COPY JC00008I.
01 OUTPUT-TXN.
COPY JC00008O.
****************************************************************
** AREA DE ERRORES **
****************************************************************
01 ERROR-AREA.
COPY AHERROR.
PROCEDURE DIVISION USING DFHEIBLK
DFHCOMMAREA
CONTEXT-AREA
INPUT-TXN
OUTPUT-TXN
ERROR-AREA.
**********************************************
* LABEL DA NON TOGLIERE SERVE COME PUNTATORE *
* AL PREPROCESSORE *
**********************************************
* START CODE PROCEDURE
PERFORM 0001-ARCH-HOUSEKEEPING.
PERFORM 0010-APPL-CODE.
PERFORM 0009-ARCH-WRAPUP.
****************************************************************
** PROCEDURE DIVISION INITIALIZATION **
****************************************************************
0001-ARCH-HOUSEKEEPING.
INITIALIZE AH-VARIABLES
OUTPUT-TXN.
MOVE AH-PROGRAM-NAME TO AH-PROGRAMA-PREVIO.
MOVE LT-PROGRAM-NAME TO AH-PROGRAM-NAME.
****************************************************************
** - CODICE APPLICATIVO **
****************************************************************
0010-APPL-CODE.
PERFORM A1000-HOUSEKEEPING.
PERFORM A2000-PROCESS.
PERFORM A3000-WRAP-UP.
****************************************************************
** - INIZIALIZZAZIONE DI VARIABILI APPLICATIVE **
****************************************************************
A1000-HOUSEKEEPING.
*
INITIALIZE JC00008O.
TOGLI * MOVE '06319' TO JCA-BO-DET-SPO-CFILI-CC.
TOGLI * MOVE '20070125' TO JCA-BO-DET-SPO-DATA-PRE.
TOGLI * MOVE ' ' TO JCA-BO-DET-SPO-PAG-UPDW.
TOGLI * MOVE ' ' TO JCA-BO-DET-SPO-PAG-CORR.
*
****************************************************************
* - GESTISCE LA LOGICA APPLICATIVA DEL COMPONENTE **
****************************************************************
A2000-PROCESS.
*
PERFORM A2001-CONTR-SPO.
*
TOGLI * DISPLAY 'JCS00008: PRIMA CHIAMATA: '
TOGLI * DISPLAY 'JCS00008: AREA INPUT: '
TOGLI * DISPLAY 'JCA-BO-DET-SPO-CFILI-CC ' JCA-BO-DET-SPO-CFILI-CC.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-DATA-PRE ' JCA-BO-DET-SPO-DATA-PRE.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-PAG-UPDW ' JCA-BO-DET-SPO-PAG-UPDW.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-PAG-CORR ' JCA-BO-DET-SPO-PAG-CORR.
*
CALL JCZRIC3T USING
DFHEIBLK
DFHCOMMAREA
INPUT-TXN
OUTPUT-TXN.
*
TOGLI * DISPLAY 'JCS00008: DOPO CHIAMATA: '
TOGLI * DISPLAY 'JCS00008: AREA OUTPUT: '
TOGLI * DISPLAY 'JCA-BO-DET-SPO-CDOPE-OUT '
TOGLI * JCA-BO-DET-SPO-CDOPE-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-CDOPE-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-CDOPE-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-CDOPE-OUT(4) ' '.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-IMPO-OUT '
TOGLI * JCA-BO-DET-SPO-IMPO-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-IMPO-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-IMPO-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-IMPO-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-NR-PREN-OUT '
TOGLI * JCA-BO-DET-SPO-NR-PREN-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-NR-PREN-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-NR-PREN-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-NR-PREN-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-CCFIL-OUT '
TOGLI * JCA-BO-DET-SPO-CCFIL-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-CCFIL-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-CCFIL-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-CCFIL-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-CONTO-OUT '
TOGLI * JCA-BO-DET-SPO-CONTO-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-CONTO-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-CONTO-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-CONTO-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-NOPER-OUT '
TOGLI * JCA-BO-DET-SPO-NOPER-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-NOPER-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-NOPER-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-NOPER-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-INTESTA-OUT '
TOGLI * JCA-BO-DET-SPO-INTESTA-OUT(1) ' '
TOGLI * JCA-BO-DET-SPO-INTESTA-OUT(2) ' '
TOGLI * JCA-BO-DET-SPO-INTESTA-OUT(3) ' '
TOGLI * JCA-BO-DET-SPO-INTESTA-OUT(4) ' ' .
TOGLI * DISPLAY 'JCA-BO-DET-SPO-QTA-PREN-OUT '
TOGLI * JCA-BO-DET-SPO-QTA-PREN-OUT.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-IMPO-TOT-OUT '
TOGLI * JCA-BO-DET-SPO-IMPO-TOT-OUT.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-FDATI '
TOGLI * JCA-BO-DET-SPO-FDATI.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-PAGIN '
TOGLI * JCA-BO-DET-SPO-PAGIN.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-MESG-COD-KO '
TOGLI * JCA-BO-DET-SPO-MESG-COD-KO.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-MESG-DESCR-KO '
TOGLI * JCA-BO-DET-SPO-MESG-DESCR-KO.
TOGLI * DISPLAY 'JCA-BO-DET-SPO-MESG-OK ' JCA-BO-DET-SPO-MESG-OK.
*
IF JCA-BO-DET-SPO-MESG-OK NOT EQUAL 'OK'
MOVE JCA-BO-DET-SPO-MESG-COD-KO TO WS-NUM-ERR
MOVE JCA-BO-DET-SPO-MESG-DESCR-KO TO NX1-DESCRIZIONE
&AQERRORV(ERROR,WS-NUM-ERR,NXERR01,
JCA-BO-DET-SPO-MESG-DESCR-KO)
END-IF.
*
PROVA PERFORM A2010-RIC-INTESTATARIO
VARYING IND FROM 1 BY 1
UNTIL IND GREATER JCA-BO-DET-SPO-QTA-PREN-OUT.
*
****************************************************************
* - GESTISCE LA LOGICA APPLICATIVA DEL COMPONENTE **
****************************************************************
A2001-CONTR-SPO.
*
MOVE JCA-BO-DET-SPO-CFILI-CC(2:4) TO WKS-SPORTELL
*
* DISPLAY ' AQBF-COD-CENTRO = ' AQBF-COD-CENTRO
*
* MOVE '1900' TO AQBF-COD-CENTRO
*
IF AQBF-COD-CENTRO NOT = JCA-BO-DET-SPO-CFILI-CC (2:4)
MOVE AQBF-COD-CENTRO TO WKS-SPORTELL
PERFORM S5000-CL-TCS07002 THRU S5000-CL-TCS07002-EX
CANC * DISPLAY 'COD-TIPO-CENTRO OF OUTPUT-TXN-TCS07002 (1) ='
CANC * COD-TIPO-CENTRO OF OUTPUT-TXN-TCS07002 (1)
IF COD-TIPO-CENTRO OF OUTPUT-TXN-TCS07002 (1) = '00'
MOVE JCA-BO-DET-SPO-CFILI-CC(2:4) TO WKS-SPORTELL
* DISPLAY 'WKS-SPORTELLO 1= ' WKS-SPORTELL
PERFORM S5000-CL-TCS08002 THRU S5000-CL-TCS08002-EX
PERFORM S5100-CL-ESITO-OPE THRU S5100-CL-ESITO-OPE-EX
ELSE
MOVE 'SPORTELLO OPERANTE NON ABILITATO'
TO JCA-BO-DET-SPO-MESG-DESCR-KO
NX1-DESCRIZIONE
MOVE 55603 TO JCA-BO-DET-SPO-MESG-COD-KO
WS-NUM-ERR
&AQERRORV(ERROR,WS-NUM-ERR,NXERR01,
JCA-BO-DET-SPO-MESG-DESCR-KO)
END-IF
END-IF.
****************************************************************
* - CONTROLLO SPORTELLO **
****************************************************************
S5000-CL-TCS07002.
INITIALIZE INPUT-TXN-TCS07002
OUTPUT-TXN-TCS07002.
*
MOVE 'V' TO ACC-SERV OF TC07002I
MOVE 1 TO NUM-REGE OF TC07002I
MOVE '0' TO IND-TIPO-LIS OF TC07002I
MOVE 1 TO NUM-CLAVE OF TC07002I
MOVE ZEROES TO NUM-CONDICION-ADICIONAL OF TC07002I
MOVE '0001' TO COD-EMPRESA OF TC07002I
MOVE WKS-SPORTELL TO COD-CENTRO OF TC07002I.
MOVE SPACES TO NOMBRE OF TC07002I.
MOVE SPACES TO COD-TIPO-CENTRO OF TC07002I.
&AQENVIAR(TCS07002,INPUT-TXN-TCS07002,
OUTPUT-TXN-TCS07002,ERROR-AREA)
* DISPLAY 'ERROR-AREA= ' ERROR-AREA
* DISPLAY ' FNDSEVEREERRORCODE = ' FNDSEVEREERRORCODE
* DISPLAY ' FNDERRORMSGAREA = 'FNDERRORMSGAREA
* IF AH-SEVERE-ERROR
* &AQERROR(ERROR, AH-ERROR-MSG-NUM, AH-ERROR-MSG-AREA)
* END-IF
IF NOT AH-SEVERE-OK
&AQERROR(ERROR, AH-ERROR-MSG-NUM, AH-ERROR-MSG-AREA)
END-IF.
*
S5000-CL-TCS07002-EX.
EXIT.
*
****************************************************************
*** ******
****************************************************************
S5000-CL-TCS08002.
*
INITIALIZE INPUT-TXN-TCS08002
OUTPUT-TXN-TCS08002.
MOVE '0001'
TO COD-EMPRESA OF INPUT-TXN-TCS08002.
MOVE 'V'
TO ACC-SERV OF INPUT-TXN-TCS08002.
MOVE 1
TO NUM-REGE OF INPUT-TXN-TCS08002.
MOVE 1
TO NUM-CLAVE OF INPUT-TXN-TCS08002.
MOVE WKS-SPORTELL
TO COD-CENTRO OF INPUT-TXN-TCS08002.
MOVE '01'
TO COD-ESTRUC-JERARQ OF INPUT-TXN-TCS08002.
&AQENVIAR(TCS08002,INPUT-TXN-TCS08002,OUTPUT-TXN-TCS08002,
ERROR-AREA)
* DISPLAY 'ERROR-AREA= ' ERROR-AREA
* DISPLAY ' FNDSEVEREERRORCODE = ' FNDSEVEREERRORCODE
* DISPLAY ' FNDERRORMSGAREA = 'FNDERRORMSGAREA
IF NOT AH-SEVERE-OK
&AQERROR(ERROR, AH-ERROR-MSG-NUM, AH-ERROR-MSG-AREA)
END-IF.
S5000-CL-TCS08002-EX.
EXIT.
*************************************************************
S5100-CL-ESITO-OPE.
*
CANC * DISPLAY ' CODIGO-CENTRO-2 OF OUTPUT-TXN-TCS08002(1)= '
CANC * CODIGO-CENTRO-2 OF OUTPUT-TXN-TCS08002(1)
*
* DISPLAY 'AQBF-COD-CENTRO ======' AQBF-COD-CENTRO
*
* IF CODIGO-CENTRO-2 OF OUTPUT-TXN-TCS08002(1)
* NOT = JCA-BO-DET-SPO-CFILI-CC (2:4)
IF CODIGO-CENTRO-2 OF OUTPUT-TXN-TCS08002(1)
NOT = AQBF-COD-CENTRO
MOVE 'SPORTELLO OPERANTE NON ABILITATO'
TO JCA-BO-DET-SPO-MESG-DESCR-KO
NX1-DESCRIZIONE
MOVE 55603 TO JCA-BO-DET-SPO-MESG-COD-KO
WS-NUM-ERR
&AQERRORV(ERROR,WS-NUM-ERR,NXERR01,
JCA-BO-DET-SPO-MESG-DESCR-KO)
ELSE
****>>> SALVO L'AREA TERRITORIALE PER I CONTROLLI DI CONGRUENZA
*** MOVE CODIGO-CENTRO-2 OF OUTPUT-TXN-TCS08002(1)
*** TO APPO-SPO-AT
CONTINUE
END-IF.
S5100-CL-ESITO-OPE-EX.
EXIT.
****************************************************************
* - RICERCA INTESTATARIO C/C SU ACCORDI **
****************************************************************
A2010-RIC-INTESTATARIO.
INITIALIZE INPUT-TXN-NK17272
OUTPUT-TXN-NK17272.
*
MOVE '0001' TO COD-EMPRESA OF NK17272I.
MOVE JCA-BO-DET-SPO-CCFIL-OUT (IND)
TO COD-SPORTELLO OF NK17272I.
MOVE JCA-BO-DET-SPO-CONTO-OUT (IND)
TO WKS-CONTO.
MOVE WKS-CONTO TO COD-CONTO OF NK17272I.
*
TOGLI * DISPLAY 'INPUT: ' INPUT-TXN-NK17272.
*
&AQENVIAR(NKS17272,INPUT-TXN-NK17272,OUTPUT-TXN-NK17272).
*
TOGLI * DISPLAY 'OUTPUT: ' OUTPUT-TXN-NK17272.
*
IF NOT AH-SEVERE-OK
MOVE ALL '*' TO JCA-BO-DET-SPO-INTESTA-OUT(IND)
* DISPLAY 'ERRORE CHIAMATA ACCORDI'
* DISPLAY 'ERROR-AREA ' ERROR-AREA
* DISPLAY 'FNDABENDCODE ' FNDABENDCODE
* DISPLAY 'FNDERRORAPPLTYPE ' FNDERRORAPPLTYPE
* DISPLAY 'FNDERRORTYPECODE ' FNDERRORTYPECODE
* DISPLAY 'FNDERRORTAGDATA ' FNDERRORTAGDATA
* DISPLAY 'FNDERRORMSGNUM ' FNDERRORMSGNUM
* DISPLAY 'FNDERRORMSGAREA ' FNDERRORMSGAREA
* DISPLAY 'FNDLOADIMAGENAME ' FNDLOADIMAGENAME
* DISPLAY 'FNDDEPMSGNUM ' FNDDEPMSGNUM
* DISPLAY 'FNDSEVEREERRORCODE' FNDSEVEREERRORCODE
ELSE
MOVE DENOM-SOCIALE TO JCA-BO-DET-SPO-INTESTA-OUT(IND)
END-IF.
*
****************************************************************
* - VALORIZZAZIONE DELL'OUTPUT MESSAGGE **
* EVENTUALI CONTROLLI PRIMA DELLA ATTIVAZIONE DELLA ROUTINE **
****************************************************************
A3000-WRAP-UP.
****************************************************************
** - VIENE GESTITA LA FINE DELL'ELABORAZIONE **
****************************************************************
0009-ARCH-WRAPUP.
IF AH-PROGRAM-NAME = APPL-PROGRAM-ID OF CONTEXT-AREA
MOVE LENGTH OF OUTPUT-TXN
TO OUTPUT-TXN-LEN OF CONTEXT-AREA
END-IF.
MOVE AH-PROGRAMA-PREVIO TO AH-PROGRAM-NAME
GOBACK.
*
00091-RAD-MANAGEMENT.
******************************************************************
* 00091-RAD-MANAGEMENT *
* VIENE REALIZZATA LA SCRITTURA DEL DAL ATTRAVERSO LA CHIAMATA *
* AL MODULO AH0500 CHE AL SUO INTERNO ESEGUIRA' UN CICLO DI *
* QUANTE SONO LE RIGHE PRESENTI NELL'OCCURS DELL'AREA DI CONTEST*
* PRECEDENTEMENTE VALORIZZATE DAL MODULO AH0501 *
******************************************************************
* CALL LT-MODULO-RAD USING
* DFHEIBLK
* DFHCOMMAREA
* CONTEXT-AREA
* INPUT-TXN
* OUTPUT-TXN
* ERROR-AREA.
*
* IF AH-SEVERE-ERROR OF ERROR-AREA
* PERFORM 00000-GESTION-ERROR
* END-IF
* .
00000-GESTION-ERROR.
******************************************************************
* 00000-GESTION-ERROR. *
* PARAGRAFO DI GESTIONE ERRORE *
* QUESTO PARAGRAFO E' CHIAMATO DALLA MACRO AQERROR *
******************************************************************
MOVE AH-PROGRAM-NAME TO AH-LOAD-IMAGE-NAME OF ERROR-AREA
* IF AH-ERROR-DB2 OF ERROR-AREA
* MOVE SQLCA TO AH-DEP-MSG-AREA OF ERROR-AREA
* MOVE SQLCODE TO AH-DEP-MSG-NUM OF ERROR-AREA
* SET AH-ERROR-TYPE-SQL OF ERROR-AREA TO TRUE
* END-IF
PERFORM 0009-ARCH-WRAPUP.
*