我从客户端收到了一个 cobol 查询,我必须将其转换为 sql。我是cobol的新手,我无法理解整个事情。非常感谢任何帮助。代码如下。
!JOB ARSRCHAA,RPT/*.IVL;OUTCLASS=LP,1
!COMMENT {PRNT$PRINTER ?$}
!COMMENT {PRI $PRIORITY ?$}
!COMMENT {CD1 $DATE ?$}
!COMMENT {CD2 $AMOUNT1 ?$}
!COMMENT {CD3 $EXCLUDE ?$}
!FILE QSLIST=ARSRCHAA;DEV={PRNT},{PRI}
!AQ
ENTER=GENLED2,FP,FP
S=ARAP-TRN
VVF VND-NO NE {CD3} AND TPE-SHP NE VX
F CONN ARAP-TRN.VND-NO TO ARAP-TOT.VND-NO; &
ARAP-TRN.VND-NO NE 0867,0249,3163,3193,3077,3263,5402,{CD3} &
AND ARAP-TRN.TPE-SHP NE VX &
REQ ARAP-TOT.VND-NO=ARAP-TRN.VND-NO
LP
R;H1,DATE,74;H2,TIME,74;H1,PAGENO,79;H1,"ARSRCHAA",8
H1,"NON-CLAIM AR'S BEFORE {CD1} ",50
H2,"FOR AMOUNTS GREATER THAN ${CD2}",50
H3,"Excludes-0867,0249,3163,3193,3077,3263,5402,{CD3}",55
H4,"ACCT NAME REG# DESCRIP",38
H4,"LAST-DT TRN# NET *COLL",79
H5,"*=On hold",13;H5,"c=Claim",62;H5,"Cr Bal=+",76
E1,"ZZ-ZZ-ZZ";E2,"ZZZ,ZZZ.99-";E3,"ZZZZ,ZZZ.99-"
E4,"XXXXXXXXXXXXXXXX";E5,"ZZZZZZZZ";E6,"XXXXXXXXXXXXXXX"
S,!DBTRAN(VNDR:DATE-INFO.IVL-DATE=TRN-DT, &
VNDR:DATE-INFO.REAL-DATE)
S1,REG-NO;S2,VND-NO
S3,!DBTRAN(VNDR:VENDOR.VND-NO=VND-NO,VNDR:VENDOR.DBA-NM)
R1,L,!DBTRAN(VNDR:DATE-INFO.IVL-DATE=TRN-DT, &
VNDR:DATE-INFO.REAL-DATE)
R3,L,{CD1}
R4,A,AMT
R5,L,1,IF !DBTRAN(REMARK:REG-COLLECT.REG-NO=REG-NO,REMARK:&
REG-COLLECT.STAT-CD) EQ OP
R6,L,1,IF NET-AMT LT 0
R7,L,1,IF &
!DBTRAN(ACTRN:TRN-INFO.TRN-NO=TRN-NO,ACTRN:TRN-INFO.TPE-CD)=CI,CC
R9,L,0
R9,L,1,IF R1 LE R3 AND R4 GT {CD2}00
R9,L,0,IF &
!DBTRAN(VNDR:VENDOR.VND-NO=VND-NO,VNDR:VENDOR.POINT-LOC)=ME,MF
R9,L,0,IF R7=1
R9,L,0,IF !DBTRAN(REMARK:REG-COLLECT.REG-NO=REG-NO,REMARK:&
REG-COLLECT.STAT-CD) EQ OP
T1,VND-NO,4,PIF R9=1
T1,"*",5,PIF R9=1 AND ARAP-TOT.A-STAT=HH
T1,!DBTRAN(VNDR:VENDOR.VND-NO=VND-NO,VNDR:VENDOR.DBA-NM),20,&
E6,PIF R9=1
T1,REG-NO,28,E5,PIF R9=1
T1,DESCRP,45,E4,PIF R9=1
T1,TRN-DT,55,E1,PIF R9=1
T1,TRN-NO,64,PIF R9=1
T1,"c",56,PIF R9=1 AND R7=1
T1,R4,75,E2,PIF R9=1
T1,"*",75,PIF R9=1 AND R5=1
T1,"+",76,PIF R9=1 AND R6=1
T1,REG-NO,78,COUNT,PIF R9=1
T1,R1
T1,R4
T1,R5
T1,R6
T1,R7
TF,"******** END OF REPORT ********",55
END
EXIT
!EOJ
我只需要将这个cobol查询转换为sql查询。这里ARAP-TRN
是主表,vendor-no
其他类似的东西是对应表的列字段,例如,这里的表是vendor
。