IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

any way to insert the record to table without using utility


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Mon Jun 29, 2015 7:24 pm
Reply with quote

HI,

I want insert the records from a ps file into a table using REXX without using any utilities.

I gave some 5 fields in my ps file and the field data type of the those fields will be same as what is present into the destination table where i want to load the file. How can I do this....?

and the number of fields in the ps file and the table may differ always. but both will always have same number of fields. like if ps file has 10 fields then table will also have 10 fields and if ps file has 50 table will have 50.

So I want to dynamically insert the records into the table....

Any help from you people will be very greatful.....

Thanks,
Sakrat
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jun 29, 2015 9:05 pm
Reply with quote

Have you looked at how to access DB2 via Rexx in the SQL Users Guide?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Moderator


Joined: 14 Mar 2007
Posts: 10730
Location: italy

PostPosted: Mon Jun 29, 2015 10:24 pm
Reply with quote

Quote:
I want insert the records from a ps file into a table using REXX without using any utilities.

You will have to write a program,
the logic will not depend on the language being used icon_cool.gif
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Jun 30, 2015 12:22 pm
Reply with quote

My Question is not about the INSERT syntax it is like when i have fields that may vary not contant number of fields, in that case how will i write the INSERT syntax statement.
Back to top
View user's profile Send private message
Smita.t2

New User


Joined: 17 Apr 2012
Posts: 28
Location: Bangalore

PostPosted: Tue Jun 30, 2015 12:34 pm
Reply with quote

Dynamic sql?
please check below link for sample program.

www-01.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/com.ibm.db2z11.doc.apsg/src/tpc/db2z_samplerexxapp.dita
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Jun 30, 2015 12:38 pm
Reply with quote

Smita.t2 wrote:
Dynamic sql?
please check below link for sample program.

www-01.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/com.ibm.db2z11.doc.apsg/src/tpc/db2z_samplerexxapp.dita


Can I use the below to insert the records in the ps file to the db2 table.

Code:


DRAW schemaname.tablename (TYPE=INSERT SSID=***

Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Jun 30, 2015 3:34 pm
Reply with quote

What language is that? You asked about Rexx and that is not Rexx.

As to a variable number of fields then you code your program to do that. but your program needs to know the format of any data that is passed to it. How you do that is up to you but you may want to read in not only the dataset but also the DCLGEN for the table that is to be updated.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. how to extract a portion (e.g. fields... SYNCSORT 8
This topic is locked: you cannot edit posts or make replies. Writng matched records into output fi... DFSORT/ICETOOL 11
No new posts Compare the file record count percent... DFSORT/ICETOOL 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
No new posts Which SORT utility can improve the Pe... DFSORT/ICETOOL 16
Search our Forums:

Back to Top