The code is just an example to get you started - i suggest you read the manual or get on a course etc to understand better the data model and language. There are numerous things you can do to extend this program, you will need to ensure there are no " in the data, the example is changing sub values to be comma delimited lists, again you will need to ensure there are no commas in the data - or you may want to normalise and produce a row in the csv per multi value, or perhaps if the multivalues are not an array of associated data but individual pieces of data you could split them to multiple columns, This very much depends on the structure of the data and what you are trying to achieve with it.
To fix the below "funny characters" replace @SVM with @VM If you do have sub values in your data you may need to do some further conversions etc Rgds Symeon -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dattatraya Walgude Sent: 12 October 2009 12:58 To: U2 Users List Subject: Re: [U2] Unibasic: Sample program - to extract data from Table Output is not readable:- "14334ýITOý0ýýýýýAýý16811","14334ýCHAý CHA to Risk Rate: Mass_Aýýýýýýý16811" "14369ýITOý0ýýýýýAýý61491","14369ýCHAý CHA to Risk Rate: Ten7_Aýýýýýýý61491" "13977ýITAýýýýýýAýý60625" "15030ýITOý0ýýýýýAýý70410","15030ýMEMý1ýPayment Responsibility ChangedýýFrom To N On 23-02-09ýýAýý70410","15030ýITAýýýýýýAýý70410" "13973ýITAýýýýýýAýý38781","13973ýCHAý CHA to Risk Rate: MASS_Aýýýýýýý38781" "15142ýITOý0ýýýýýAýý40128","15142ýMEMý1ýPayment Responsibility ChangedýýFrom To Y On 15-06-09ýýAýý40129" "14369ýITOý0ýýýýýAýý64849","15263ýWKLýDC 040ýQueue 888ýýýýAýý47136" "13910ýWKLýDC 040ýQueue 6AEýýýýAýý2898","13910ýSAPý13910ý6RE1ý1ý60+DAY EA ROUTE 1ýQ6AEýAýý7858","13910ýSUSýFailed ValidationýýýWITH SIXTYD.ABOVE.AMT.OVRD GE 10.00 ý6RE1ýAýý14692","13911ýAOWýFrom BF01G013ýTo BF01G162ý6EQ.01ýQUEUE-SPLITTERýýAýý15360","13911ýWKLýDC 040ýQueue 6EQ.03ýýQUEUE-SPLITTERýýAýý15360","13942ý WKLýDC 040ýQueue 6AEýýýýAýý5421","13942ýSAPý13942ý6RE1ý1ý60+DAY EA ROUTE 1ýQ6AEýAýý9757","13942ýSUSýFailed ValidationýýýWITH SIXTYD.ABOVE.AMT.OVRD GE 10.00 ý Thanks & Regards, Dattatraya Walgude -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dattatraya Walgude Sent: Monday, October 12, 2009 5:02 PM To: U2 Users List Subject: Re: [U2] Unibasic: Sample program - to extract data from Table Many Many Thanks Edward and Symeon Its work... Thanks & Regards, Dattatraya Walgude -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Edward Brown Sent: Monday, October 12, 2009 4:55 PM To: U2 Users List Subject: Re: [U2] Unibasic: Sample program - to extract data from Table ELSE NULL Will work. Syntax for all these commands is in BASR.PDF, downloadable from web for free... Edward -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dattatraya Walgude Sent: 12 October 2009 12:22 To: U2 Users List Subject: Re: [U2] Unibasic: Sample program - to extract data from Table Thanks Symeon I have created one program file (outfile ) with followinf contents Facing compilation error OPEN 'CUSTOMER' TO FIL ELSE STOP 201 'CUSTOMER' OPENSEQ 'OUTPUT.CSV' TO CSVFIL WEOFSEQ CSVFIL SELECT FIL LOOP WHILE READNEXT ID DO READ REC FROM FIL,ID THEN LINE = '"' : CHANGE(CHANGE(REC,@AM,'","'),@SVM,',') : '"' WRITESEQ LINE ON CSVFIL ELSE CRT 'CAN NOT EWRITE TO CSV FILE' END REPEAT Facing compilation error :BASIC BP outfile Compiling Unibasic: BP/outfile in mode 'u'. main program: syntax error at or before <line 2> OPENSEQ 'OUTPUT.CSV' TO CSVFIL ------------------------------^ Expecting: ELSE compilation failed Thanks & Regards, Dattatraya Walgude DBA Team Rsystems International Ltd, Pune, ( : +91-20-22909212 -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Symeon Breen Sent: Monday, October 12, 2009 4:28 PM To: 'U2 Users List' Subject: Re: [U2] Unibasic: Sample program - to extract data from Table The big question is extract to what ? csv ? xml ? another data table ? Here is a very quick simple extract to a csv - this is just off the top of my head so i have not compiled it or tested it. OPEN 'FILE' TO FIL ESLE STOP 201,'FILE' OPENSEQ 'OUTPUT.CSV' TO CSVFIL WEOFSEQ CSVFIL SELECT FIL LOOP WHILE READNEXT ID DO READ REC FROM FIL,ID THEN LINE = '"' : CHANGE(CHANGE(REC,@AM,'","'),@SVM,',') : '"' WRITESEQ LINE ON CSVFIL ELSE CRT 'CAN NOT EWRITE TO CSV FILE' END REPEAT Rgds Symeon. -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dattatraya Walgude Sent: 12 October 2009 06:14 To: u2-users@listserver.u2ug.org Subject: [U2] Unibasic: Sample program - to extract data from Table Dear All I am new in Unidata/Unibasic, I want a sample program to extract data from one of our big history table. Kindly give me any link/ suggestion. Thanks & Regards, Dattatraya Walgude **************** Disclaimer ***************** This mail, including any attachments contains confidential and privileged information for the sole use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and are unlawful. This e-mail may contain viruses. R Systems International Limited has taken every reasonable precaution to minimize this risk. R Systems International Limited is not liable for any damage you may sustain as a result of any virus in this e-mail. Before opening the e-mail or attachment, You should carry out your own virus checks. R Systems International Limited reserves the right to record, monitor, and inspect all email communications through its internal and external networks. R Systems International Ltd prohibits its information systems from being used to view, store or forward offensive or discriminatory material. ******** End of Disclaimer ******** _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ---------------------------------------------------------------------------- --------------- Please remember to recycle wherever possible. Reduce, reuse, recycle, think do you need to print this e-mail? ---------------------------------------------------------------------------- --------------- This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring. Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No. 01628868 Both companies are registered in England and Wales and each has its registered office at 2 Burston Road, Putney, London, SW15 6AR. ---------------------------------------------------------------------------- --------------- _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users