View previous topic :: View next topic
|
Author |
Message |
Vkp321
New User
Joined: 05 Jan 2009 Posts: 56 Location: Dublin
|
|
|
|
Hi
Is it possible to pass field name to COBOL program next use that field for database update.
Example:
Database has a feild XYZ
I need to update field XYZ on a database, I want to pass the string XYZ and value 10
how to use string XYZ to identify the variable
Thanks & Regards
PKV |
|
Back to top |
|
|
John Del
New User
Joined: 27 Apr 2012 Posts: 42 Location: NY
|
|
|
|
Yes. |
|
Back to top |
|
|
Vkp321
New User
Joined: 05 Jan 2009 Posts: 56 Location: Dublin
|
|
|
|
Hi John Del
Could you please help and explain how this can be achieved |
|
Back to top |
|
|
John Del
New User
Joined: 27 Apr 2012 Posts: 42 Location: NY
|
|
|
|
Write a COBOL update program by coding an IF statement for each database field (variable) possible that you think that you might want to update. Then have the program read in an input dataset (or file! or sysin or parm) that each logical record utilizes delimited fields comprised of the selection item, the db field variable to update, and the new value for that field. Program unstrings the input, validates what it read in for numerics, valid ranges, valid values, etc, and then does the update of the dbFieldVariable to the new value.
Input sample:
selectionItem|databaseFieldVariable|newValue
To help build your "IF" statements quickly for the COBOL program processing routine, obtain a listing of the database dictionary in a dataset and you could easily use sort to build generic "IF and "MOVE" statements for each field/variable in the database data dictionary. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
why would you want to invent something like this ? Do you want to do a mass update ? Who gave you such requirements or you are simply doing one of those FAQ tests? There are various methods to do a mass updates but you need to list the original requirements. |
|
Back to top |
|
|
Vkp321
New User
Joined: 05 Jan 2009 Posts: 56 Location: Dublin
|
|
|
|
Hi Rohit,
I am thinking of automation some time we get work to update a field which was corrupted and rest is required.
Thanks & Regards
Pradeep |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Vkp321 wrote: |
I am thinking of automation some time we get work to update a field which was corrupted and rest is required. |
Utter imbeciles!
You don't correct a field that has been corrupted, you sort out why it was corrupted in the first place! |
|
Back to top |
|
|
Vkp321
New User
Joined: 05 Jan 2009 Posts: 56 Location: Dublin
|
|
|
|
Thank you John Del
What I understood to give SYSIN inputs as per defined field structure
01 FIELD1
02 FIELD2
03 FIELD3
and we want to update FIELD2 with value XX
Provide SYSIN input
02 XX
and in COBOL program accept these values on variable
SEQNO and NWVAL
and have IF statement to identify the field for updation
If SEQNO = 01
MOVE NEWVAL TO FIELD1
END-IF
If SEQNO = 02
MOVE NEWVAL TO FIELD2
END-IF
just curious to know in case any dynamic way is also possible |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I am thinking of automation some time we get work to update a field which was corrupted and rest is required. |
so ...
if some mission critical data gets corrupted,
the first moron around can run a job without any safety net and without any audit trail
wonderful management you have there |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Vkp321 wrote: |
Hi Rohit,
I am thinking of automation some time we get work to update a field which was corrupted and rest is required.
Thanks & Regards
Pradeep |
When that happens most of the time you require to fix the upstream and the issue don’t occurs again , second you can write one time program which will update the field to correct value , or use DFSORT/SYNCSORT to overlay the bad value with correct value and most importantly each time you do these updates will go thru a review process . Either of these methods takes no more than few hours but provides you the assurance of correctness.
What you are trying to do sounds interesting but that’s not the way to do in production unless you go thru proper SDLC and complete testing. Second if the database (which you haven’t told yet ) gets added more fields or change if field size the. This program must be changed ( dependable ). Note that take a backup before you do anything with either of the solution as if your process fails then you must have a way to restore else some serious consequences may happen :-)
Good Luck! |
|
Back to top |
|
|
Vkp321
New User
Joined: 05 Jan 2009 Posts: 56 Location: Dublin
|
|
|
|
Hi Rohit,
Thank you for sharing your thoughts, every system has few important fields on database and their values are defined so for these fields we can automate the process, yes you are right to take backup before doing such updates
Thanks & Regards
Pradeep |
|
Back to top |
|
|
|