In this tutorial we will open a file and read its ID by looping the file and save those ID to a Sequential File for later use.
Code Sample
SUBROUTINE PK.B.INTF.TUTORIALJINNI.DEMO $INSERT I_COMMON $INSERT I_EQUATE $INSERT I_F.FILENAME GOSUB INIT GOSUB PROCESS RETURN INIT: *//* INITIALIZING VARIABLES *** FN.ACT = 'F.FILENAME' F.ACT = '' ID = '' ARR = '' ACT.ERR1 = '' SEL.CMD = '' SEL.LIST = '' NO.OF.REC = 0 RETURN.CODE = '' RETURN PROCESS: *//**** DIRECTORY.NAME="PATH.WHERE.TO.SAVE.FILE" FILE.NAME = "FILE.NAME" OPENSEQ DIRECTORY.NAME,FILE.NAME TO SEQ.FILE.POINTER ELSE CREATE SEQ.FILE.POINTER ELSE RETURN END END *//**** CALL OPF(FN.ACT,F.ACT) SEL.CMD = "SELECT ":FN.ACT:" CALL EB.READLIST(SEL.CMD,SEL.LIST,'',NO.OF.REC,RETURN.CODE) IF NO.OF.REC GT 0 THEN LOOP REMOVE ID FROM SEL.LIST SETTING POS WHILE ID:POS CALL F.READ(FN.ACT,ID,ARR,F.ACT,ACT.ERR1) VALUE.ID = ID TOFILE=VALUE.ID WRITESEQ TOFILE APPEND TO SEQ.FILE.POINTER THEN END REPEAT END CLOSESEQ SEQ.FILE.POINTER ;*// SEQUENTIAL FILE CLOSE RETURN END
5 comments:
can u post write file using mulithread?
you can use JBASETHREADCreate command to start a new thread...
method signature is...
JBASETHREADCreate(ProgramName, Arguments, User, Handle)
may it help you...
you can also monitor status of threads running by issuing command JBASETHREADStatus(ThreadList)
Please share me how to get filename in routine without hardcode or parameterize ?
What about extract file from directory then upload the data to T24.
Post a Comment