View previous topic :: View next topic
|
Author |
Message |
Venkat94
New User
Joined: 19 May 2021 Posts: 2 Location: India
|
|
|
|
Hi All,
My requirement is I will have a set of conditions in a file, which can be updated time to time. But my COBOL module should check all the conditions and should process accordingly.
For example,
My file layout is
Field X(10)
Value X(10)
In file, we will have
WS-CITY HYDERABAD
WS-PIN 500072
Here WS-CITY and WS-PIN are my DB fields. So My module should check that DB and write all the records having WS-CITY as HYDERABAD and WS-PIN as 500072
And next day the file might contain new fields like
WS-DAY MONDAY
WS-CITY HYDERABAD
WS-PIN 500072
So, now my module should check all the three Db fields for their respective values and if the conditions satisfy, then should write into file.
There is no info about how many fields can come, if we have that limit I think we can move the field into conditional variable and have one each condition for each 88 variable. But that is not the case, so now my module should be super dynamic to handle this.
Any possible way?? Any suggestions?? |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
Welcome!
You could always check like this, It works. Repeat this for all the possible columns from that table . Its a batch so should be fine.
Just default the spaces if they are not populated.
Code: |
select a,b,c,d
from table
where
(e = :WS-DAY OR :WS-DAY = ' ') AND
(f = :WS-CITY OR :WS-CITY = ' ') AND
(g = :WS-PIN OR :WS-PIN = ' ') |
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2159 Location: USA
|
|
|
|
You cannot handle in COBOL any input records with unpredictable, and unexpected bunch of fields.
Your code needs to be rewritten after any change in input fields structure/format/size/datatype, and especially - the total number of fields in one single line (record).
Flexible record formats, such as XML, - is a completely different story.
Period. |
|
Back to top |
|
 |
Venkat94
New User
Joined: 19 May 2021 Posts: 2 Location: India
|
|
|
|
Thanks for your responses.
Sorry Rohit, my bad, I did not mention it as an IMS DB. So input file will have the IMS DB fileds and their possible values. I need to sweep the entire IMS DB and check for those fields and write into a file, if they are satisfied.
Thanks,
Venkat.[/img] |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
That’s okay. I am not sure about parent child relationship and total segments to sweep thru.
But I believe you would have to make mandatory a parent segment and read all the child segment and then do a compare against input fields , read further against those child one level or more level down based on other input filters by ignoring other Child segments and do a write.. . something of this nature should do. |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10891 Location: italy
|
|
|
|
are the fields you are dealing with root/child keys ???
if not your organisation has two option ...
restructure the database adding the proper keys
unload the database and process the sequential dataset created |
|
Back to top |
|
 |
|