How to Append Data to the End of Existing File in infobasic

956 views
Skip to first unread message

Neeraj

unread,
Feb 25, 2013, 3:18:00 AM2/25/13
to jb...@googlegroups.com
How to Append Data to the End of Existing File using infobasic?

scenario:

currently when i enter the customer id, 193577 , then the related data to the Customer id is retrieved and write to a file . and then again when i run the same program and give another customer id , 193588 then the previous data was overwrite by new one.
but i would like to append  all the data in same file.
How it will be possible?

Please Suggest me with solution.

Regard
Neeraj

Sastry

unread,
Feb 25, 2013, 8:16:25 AM2/25/13
to jb...@googlegroups.com
Dear,

Use OPENSEQ and WRITESEQ.

Regards,
SASTRY


--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
 
---
You received this message because you are subscribed to the Google Groups "jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Daniel Klein

unread,
Feb 25, 2013, 8:29:58 AM2/25/13
to jb...@googlegroups.com
rec1<-1> = rec2

Dan


Kevin Powick

unread,
Feb 25, 2013, 9:21:25 AM2/25/13
to jb...@googlegroups.com

On Monday, 25 February 2013 03:18:00 UTC-5, Neeraj wrote:

How to Append Data to the End of Existing File using infobasic?


Append to the end of an existing file, or an existing record?  Two different things in multivalue databases such as jBASE.  You say "file", but you describe records.

Show us your code and you're likely to get a more helpful reply than those already provided.

--
Kevin Powick 

Dick Thiot

unread,
Feb 25, 2013, 9:28:12 AM2/25/13
to jb...@googlegroups.com
What type of file are you accessing?  There are different solutions for the different file types.  If the CustomerID is the key to the file and you are using a "hashed" file then your data shouldn't be overwritten using different CustomerIDs since hashed files require a unique key field and store the data (record) into the file based on that key field.  If you are using a flat (O/S) file then the OPENSEQ and WRITESEQ statements are appropriate.

Neeraj

unread,
Feb 25, 2013, 11:40:49 PM2/25/13
to jb...@googlegroups.com
HERE IS MY CODE
*    SUBROUTINE CUS.DISPLAY.TEST
***
    PROGRAM CUS.DISPLAY.TEST
***
    $INSERT I_COMMON
    $INSERT I_EQUATE
    $INSERT I_F.CUSTOMER
***
    GOSUB INIT
    GOSUB OPENFILES
    GOSUB PROCESS
    RETURN
**
INIT:
    FN.CUS = 'FBNK.CUSTOMER'
    F.CUS = ''
    Y.CUS.ID = ''
    Y.MNEMONIC = ''
    Y.NATIONALITY = ''
    R.CUSTOMER = ''
    CUS.ERR1 = ''
***
    FN.EX = "FILE.EXTRACT"
    FV.EX = ""
    OPEN FN.EX TO FV.EX ELSE OPEN.ERROR = -1
    CUS.DATA = ''
    CUS.DATA<-1> = "CUSTOMER ID*MNEMONIC*NATIONALITY"
    RETURN
OPENFILES:
*****
    CALL OPF(FN.CUS,F.CUS)
    RETURN
PROCESS:
***
    CRT "ENTER YOUR CUSTOMER ID :"; INPUT Y.CUS.ID

    CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
    Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
    Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
    CUS.DATA<-1> = Y.CUS.ID:'*':Y.MNEMONIC:'*':Y.NATIONALITY
***
* CRT "Customer Id: ":Y.CUS.ID
* CRT "Customer Mnemonic: ":Y.MNEMONIC
* CRT "Customer Nationality: ":Y.NATIONALITY
****
WRITE CUS.DATA TO FV.EX, "CUS.INFO" ON ERROR WRITE.ERR = -1
     RETURN
     RETURN
 END


--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
 
---
You received this message because you are subscribed to the Google Groups "jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
With Regards,
Niraj

Neeraj

unread,
Feb 25, 2013, 11:38:07 PM2/25/13
to jb...@googlegroups.com

Kevin Powick

unread,
Feb 26, 2013, 11:17:43 AM2/26/13
to jb...@googlegroups.com

Interesting code.  The issue is that you keep overwriting "CUS.INFO" with the contents of "CUS.DATA", which is the current customer you've selected to read.

If you want the record "CUS.INFO" to have appended to it the contents of CUS.DATA, you'll have to read in the current value for CUS.INFO first, then append to it CUS.DATA before writing CUS.INFO back to disk.  See below for the lines I've added to your PROCESS subroutine.

Note:  Quickly looking at your code, I don't think that the changes I've made will give you exactly the desired results, but it should at least demonstrate what you need to do.

Kevin Powick


   ***** NEW/MODIFIED LINES HERE *****
   READ INFO FROM FV.EX, "CUS.INFO" THEN
      INFO<-1> = CUS.DATA   
   END ELSE
      INFO = CUS.DATA   
   END
   WRITE INFO ON FV.EX, "CUS.INFO"
   ***********************************
     RETURN
     RETURN
 END
Message has been deleted

Naveed Ahmed Nayyar

unread,
Feb 27, 2013, 1:27:23 AM2/27/13
to jb...@googlegroups.com
Hi Niraj,

Hope you are doing well.

You may use for append the data with this code. 

OPENSEQ FOLDER.ID,Y.FILE TO F.EXT.ERR ELSE
         CREATE F.EXT.ERR ELSE
             STOP
         END
     END

 WRITESEQ MY.DATA APPEND TO F.EXT.ERR ELSE

Apply above code and update me if your issue will resolve.
Thanks & Regards,
--------------------------------
Naveed Ahmed Nayyar
T24 Technical Consultant
Phone: +923225734761
Email: nahmed...@gmail.com
Temenos Core Banking Solution

Neeraj

unread,
Feb 27, 2013, 6:39:52 AM2/27/13
to jb...@googlegroups.com, nahmed...@gmail.com
Dear Naveed

Thanks for your mail. Here is code that i compiled after getting your mail.

*-----------------------------------------------------------------------------
 * <Rating>-37</Rating>
 *-----------------------------------------------------------------------------
 *    SUBROUTINE CUS.DISPLAY.TEST
 ***
     PROGRAM CUS.DISPLAY.TEST
 ***
     $INSERT I_COMMON
     $INSERT I_EQUATE
     $INSERT I_F.CUSTOMER
 ***
     GOSUB INIT
     GOSUB OPENFILES
     GOSUB PROCESS
     RETURN
 **
 INIT:
     FN.CUS = 'FBNK.CUSTOMER'
     F.CUS = ''
     Y.CUS.ID = ''
     Y.MNEMONIC = ''
     Y.NATIONALITY = ''
     R.CUSTOMER = ''
     CUS.ERR1 = ''
 ***
    * FN.EX = "TEST.EXTRACT"
    * FV.EX = ""
    * OPEN FN.EX TO FV.EX ELSE OPEN.ERROR = -1
     CUS.DATA = ''
     CUS.DATA<-1> = "CUSTOMER ID*MNEMONIC*NATIONALITY"
     RETURN
 OPENFILES:
 *****
     CALL OPF(FN.CUS,F.CUS)
     RETURN
 PROCESS:
 ***
     CRT "ENTER YOUR CUSTOMER ID :"; INPUT Y.CUS.ID

     CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
     Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
     Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
     CUS.DATA<-1> = Y.CUS.ID:'*':Y.MNEMONIC:'*':Y.NATIONALITY
 ***
 * CRT "Customer Id: ":Y.CUS.ID
 * CRT "Customer Mnemonic: ":Y.MNEMONIC
 * CRT "Customer Nationality: ":Y.NATIONALITY
 ****
 *WRITE CUS.DATA TO FV.EX, "CUS.INFO" ON ERROR WRITE.ERR = -1
     
     FOLDER.ID = "/dr/bnk/bnk.run/TEST.EXTRACT"
     Y.FILE = "FILE.TXT"
     OPENSEQ FOLDER.ID,Y.FILE TO F.EXT.ERR ELSE
         CREATE F.EXT.ERR ELSE
             STOP
         END
     END

     WRITESEQ CUS.DATA APPEND TO F.EXT.ERR ELSE
         RETURN
         RETURN
END



*****************
OUTPUT :
-------
CUSTOMER ID*MNEMONIC*NATIONALITY
01901135860017**
CUSTOMER ID*MNEMONIC*NATIONALITY
01901635861017**
CUSTOMER ID*MNEMONIC*NATIONALITY
01901975861517**

************************************

 IT ONLY WRITE THE ID, BUT WE NEED  MNEMONIC AND NATIONALITY ALSO.
PLEASE HELP ME WITH REQUIRED CODE.

Thanks Once again.

Regard
Niraj


Naveed Ahmed Nayyar

unread,
Feb 27, 2013, 7:27:02 AM2/27/13
to Neeraj, jb...@googlegroups.com
Dear Niraj,

Kindly check below mentioned code.

*-----------------------------------------------------------------------------
* <Rating>-46</Rating>
*-----------------------------------------------------------------------------
    PROGRAM CUS.DISPLAY.TEST

    $INSERT I_COMMON
    $INSERT I_EQUATE
    $INSERT I_F.CUSTOMER


    GOSUB INIT
    GOSUB OPENFILES
    GOSUB PROCESS

    RETURN

INIT:

    FN.CUS = 'F.CUSTOMER'
    F.CUS = ''

    Y.CUS.ID = ''
    Y.MNEMONIC = ''
    Y.NATIONALITY = ''
    R.CUSTOMER = ''
    CUS.ERR1 = ''


* FN.EX = "TEST.EXTRACT"
* FV.EX = ""
* OPEN FN.EX TO FV.EX ELSE OPEN.ERROR = -1

    CUS.DATA = ''
    CUS.DATA<-1> = "CUSTOMER ID*MNEMONIC*NATIONALITY"

    RETURN

OPENFILES:

    CALL OPF(FN.CUS,F.CUS)

    RETURN

PROCESS:

    CRT "ENTER YOUR CUSTOMER ID :"; INPUT Y.CUS.ID

    CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
    Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
    Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>

    CUS.DATA<-1> = Y.CUS.ID:'*':Y.MNEMONIC:'*':Y.NATIONALITY
GOSUB CREATE.RPT

* CRT "Customer Id: ":Y.CUS.ID
* CRT "Customer Mnemonic: ":Y.MNEMONIC
* CRT "Customer Nationality: ":Y.NATIONALITY

RETURN

CREATE.RPT:

        FOLDER.ID = "/dr/bnk/bnk.run/TEST.EXTRACT"
        Y.FILE = "FILE.TXT"

        OPENSEQ FOLDER.ID,Y.FILE TO F.EXT.ERR ELSE
            CREATE F.EXT.ERR ELSE
                STOP
            END
        END

        WRITESEQ CUS.DATA APPEND TO F.EXT.ERR ELSE
        END

  RETURN

END

Send you output.

Naveed Ahmed Nayyar

unread,
Feb 27, 2013, 7:42:34 AM2/27/13
to Qaseemuddin Shaikh, jb...@googlegroups.com
Dear Qaseemuddin,

kindly send me the output because Niraj said to me again that his output remain same.

I have send him my output mentioned below;

File AML.BP , Record 'FILE.TXT'                                                                    Insert      17:36:42
Command->
0001 CUSTOMER ID*MNEMONIC*NATIONALITY
0002 115628*A115628*PK
0003 CUSTOMER ID*MNEMONIC*NATIONALITY
0004 115629*A115629*PK




On Wed, Feb 27, 2013 at 5:40 PM, Qaseemuddin Shaikh <qudd...@gmail.com> wrote:
Hope your fine.

Rotuine is running OK! check your Customer data or in DEBUG MODE.

On Wed, Feb 27, 2013 at 4:39 PM, Neeraj <niraj...@gmail.com> wrote:



--
Regards,
Qaseem Uddin Shaikh
_________________________________
Technical Consultant & Data Migration
National Data Consultant Pvt Ltd
Office telephone: +92 (21) 35842033 , +92 (21) 358245357
Banking technology consulting intelligence
Skype id: qaseemshaikh

Qaseemuddin Shaikh

unread,
Feb 27, 2013, 7:40:37 AM2/27/13
to jb...@googlegroups.com, nahmed...@gmail.com
Hope your fine.

Rotuine is running OK! check your Customer data or in DEBUG MODE.

On Wed, Feb 27, 2013 at 4:39 PM, Neeraj <niraj...@gmail.com> wrote:



--

Qaseemuddin Shaikh

unread,
Feb 28, 2013, 1:48:54 AM2/28/13
to Naveed Ahmed Nayyar, jb...@googlegroups.com
MY OUTPUT IS :

CUSTOMER ID*MNEMONIC*NATIONALITY
100131*A0100131*PK
CUSTOMER ID*MNEMONIC*NATIONALITY
100132*A0100132*PK
Reply all
Reply to author
Forward
0 new messages