Hello. I have a legacy QBasic application that I want to convert to PBCC
I Have three question for anyone out there that has experince in this:
1. I am using BTRIEVE (7.9 Version PSQL 2000i). I have set up INCLUDEs to read specific files. Below is part of the INCLUDE that reads File 5.
How would you handle a FIELD statement PBCC?
How would you code the DECLARE for WBTRV32.DLL?
The third question has to do with PRINT USING. I Use that a lot. Do I have convert all my numeric prints to strings to print in PBCC.
Thanks for the Help.
5001 ' SAVE"C:F5PROD.INC",
5003 '* 5000-5099 ** 10/27/2008 ** Subroutine to open PRODUCTION ORDER FILE #5.*
5005 ' DIM F5KLEN%(7),F5TYPE$(7),F5DUP$(7),F5KEYS$(7)
F5NAME$ = "PRODORDR.DAT " '<====== NOTE file name here ==============
B5LRECL% = 128 '<====== NOTE Logical Record Length here ==
5009 'Keylen,Typ,Dup,Field Name
5011 DATA 07,"D"," ","Production Order No."
DATA 06,"U","D","Production Ordr Date"
DATA 12,"U","D","Production Ordr Item"
DATA 18,"U"," ","PO Date / Item No. "
DATA 06,"U","D","PO Complete Date "
DATA 18,"U"," ","PO Comp Date/Item No"
DATA 00,"C"," ","KEY6"
DATA 00,"C"," ","KEY7"
5029 RESTORE 5011
FOR I = 0 TO 7: READ F5KLEN%(I),F5TYPE$(I),F5DUP$(I),F5KEYS$(I): NEXT I
OPEN "NUL" AS #5 LEN=B5LRECL% 'BASIC open; Set BTRIEVE Pos Block Area.
FIELD #5, B5LRECL% AS F5REC1$ ' <======== Note FIELD statement.
B5POS$ = SPACE$(128)
B5KEYNUM% = 0: F5KEYL% = F5KLEN%(B5KEYNUM%) 'File 5 key length.
B5KEY$ = F5NAME$: B5STATUS% = 0: B5LOCK$ = "N": B5LOCKF$ = "N": B5OPCODE%=BOPEN%: GOSUB 5100 'Go BTRIEVE open the file.
IF B5STATUS% = 0 THEN 5065 'ERROR occurred if Status <> 0
DBNAME$ = F5NAME$: BSTATUS% = B5STATUS%: BOPCODE% = B5OPCODE%: BKEY$ = B5KEY$: GOSUB 700
5065 B5KEY$ = SPACE$(F5KEYL%) 'Init key field to blanks.
5099 RETURN
5100 '* 5100-5299 ** Subroutine to perform BTRIEVE I/O for file #5. **********
IF B5LOCK$ = "Y" THEN B5OP% = B5OPCODE% + BLOCKWN%: B5LOCKF$ = "Y": B5LOCK$ = "N" ELSE B5OP% = B5OPCODE%
IF B5OPCODE%=BINSERT% OR B5OPCODE%=BUPDATE% THEN GOSUB 5400
B5FCBPTR% = VARPTR(#5)
CALL BTRV(B5OP%,B5STATUS%,B5POS$,B5FCBPTR%,B5LRECL%,B5KEY$,B5KEYNUM%)
IF DEBUG$ <> "D" THEN 5120
LOCATE 23,1,0: PRINT USING "File 5 I/O - Op=## Lock=! Stat=## Keyl=## Key=\ \ Keynm=#";B5OPCODE%;B5LOCKF$;B5STATUS%;LEN(B5KEY$);B5KEY$;B5KEYNUM%;
MSG$ = " Press ENTER to continue.": IBUFF$="Y": GOSUB 200: LOCATE 23,1,0: PRINT SPACE$(79);
5120 DBNAME$ = F5NAME$: BSTATUS% = B5STATUS%: BOPCODE% = B5OPCODE%: BKEY$ = B5KEY$
IF B5STATUS% <> 0 THEN 5170
IF B5OPCODE%>4 AND B5OPCODE%<14 THEN GOSUB 5300 'Get data into local variables.
5170 IF B5OPCODE% < 5 THEN B5LOCKF$ = "N"
5199 RETURN
I Have three question for anyone out there that has experince in this:
1. I am using BTRIEVE (7.9 Version PSQL 2000i). I have set up INCLUDEs to read specific files. Below is part of the INCLUDE that reads File 5.
How would you handle a FIELD statement PBCC?
How would you code the DECLARE for WBTRV32.DLL?
The third question has to do with PRINT USING. I Use that a lot. Do I have convert all my numeric prints to strings to print in PBCC.
Thanks for the Help.
5001 ' SAVE"C:F5PROD.INC",
5003 '* 5000-5099 ** 10/27/2008 ** Subroutine to open PRODUCTION ORDER FILE #5.*
5005 ' DIM F5KLEN%(7),F5TYPE$(7),F5DUP$(7),F5KEYS$(7)
F5NAME$ = "PRODORDR.DAT " '<====== NOTE file name here ==============
B5LRECL% = 128 '<====== NOTE Logical Record Length here ==
5009 'Keylen,Typ,Dup,Field Name
5011 DATA 07,"D"," ","Production Order No."
DATA 06,"U","D","Production Ordr Date"
DATA 12,"U","D","Production Ordr Item"
DATA 18,"U"," ","PO Date / Item No. "
DATA 06,"U","D","PO Complete Date "
DATA 18,"U"," ","PO Comp Date/Item No"
DATA 00,"C"," ","KEY6"
DATA 00,"C"," ","KEY7"
5029 RESTORE 5011
FOR I = 0 TO 7: READ F5KLEN%(I),F5TYPE$(I),F5DUP$(I),F5KEYS$(I): NEXT I
OPEN "NUL" AS #5 LEN=B5LRECL% 'BASIC open; Set BTRIEVE Pos Block Area.
FIELD #5, B5LRECL% AS F5REC1$ ' <======== Note FIELD statement.
B5POS$ = SPACE$(128)
B5KEYNUM% = 0: F5KEYL% = F5KLEN%(B5KEYNUM%) 'File 5 key length.
B5KEY$ = F5NAME$: B5STATUS% = 0: B5LOCK$ = "N": B5LOCKF$ = "N": B5OPCODE%=BOPEN%: GOSUB 5100 'Go BTRIEVE open the file.
IF B5STATUS% = 0 THEN 5065 'ERROR occurred if Status <> 0
DBNAME$ = F5NAME$: BSTATUS% = B5STATUS%: BOPCODE% = B5OPCODE%: BKEY$ = B5KEY$: GOSUB 700
5065 B5KEY$ = SPACE$(F5KEYL%) 'Init key field to blanks.
5099 RETURN
5100 '* 5100-5299 ** Subroutine to perform BTRIEVE I/O for file #5. **********
IF B5LOCK$ = "Y" THEN B5OP% = B5OPCODE% + BLOCKWN%: B5LOCKF$ = "Y": B5LOCK$ = "N" ELSE B5OP% = B5OPCODE%
IF B5OPCODE%=BINSERT% OR B5OPCODE%=BUPDATE% THEN GOSUB 5400
B5FCBPTR% = VARPTR(#5)
CALL BTRV(B5OP%,B5STATUS%,B5POS$,B5FCBPTR%,B5LRECL%,B5KEY$,B5KEYNUM%)
IF DEBUG$ <> "D" THEN 5120
LOCATE 23,1,0: PRINT USING "File 5 I/O - Op=## Lock=! Stat=## Keyl=## Key=\ \ Keynm=#";B5OPCODE%;B5LOCKF$;B5STATUS%;LEN(B5KEY$);B5KEY$;B5KEYNUM%;
MSG$ = " Press ENTER to continue.": IBUFF$="Y": GOSUB 200: LOCATE 23,1,0: PRINT SPACE$(79);
5120 DBNAME$ = F5NAME$: BSTATUS% = B5STATUS%: BOPCODE% = B5OPCODE%: BKEY$ = B5KEY$
IF B5STATUS% <> 0 THEN 5170
IF B5OPCODE%>4 AND B5OPCODE%<14 THEN GOSUB 5300 'Get data into local variables.
5170 IF B5OPCODE% < 5 THEN B5LOCKF$ = "N"
5199 RETURN
Comment