2
votes

I got a cobol query from client and I have to convert it to sql. I am new to cobol and I am not able to understand the whole thing. Any help is greatly appreciated.The code is given below.

!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

I just need to convert this cobol query into sql query.Here ARAP-TRN is the main table, vendor-no and other similar things are column fields of the corresponding tables say for example,here the table is vendor.

1
This isn't COBOL. Looks more like some Assembler type language or macro facility. - NealB
This is not Cobol. This is a report writer of some kind. I'm trying to figure out which report writer. - Gilbert Le Blanc
Oh..Is it..I am unaware. I am trying to find out a solution to convert this into sql.. - shakz
Best I've been able to determine is this was run on a Gould/Systems Engineering Laboratories minicomputer. - Gilbert Le Blanc
The !JOB ARSRCHAA,RPT/*.IVL;OUTCLASS=LP,1 is job control language. As far as I know, SEL was the only company to use ! as a job control language identifier. - Gilbert Le Blanc

1 Answers

0
votes

I'm not familiar with this report writer, but here's my best guess.

There are 3 tables; VNDR, REMARK, and ACTRN.

VNDR has these columns; VND-NO, DBA-NM, IVL-DATE, REAL-DATE, POINT-LOC

REMARK has these columns; REG-NO, STAT-CD

ACTRN has these columns; TRN-NO, TPE-CD

ARAP-TRN is a transaction file that contains VND-NO, which is the key to VNDR. It also contains the fields REG-NO, DESCRP, TRN-DT, and TRN-NO. REG-NO is the key to REMARK. TRN-NO is the key to ACTRN.

ARAP-TOT is a total file. I'm assuming it's created outside of this report.

TPE-SHP, I'm guessing, is another column of either ARAP-TRN or ACTRN.

If anyone knows what report writer this is, please write your answer as a comment to my answer. I'd love to know.