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

Dynamic condition checks


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Venkat94

New User


Joined: 19 May 2021
Posts: 2
Location: India

PostPosted: Wed May 19, 2021 12:43 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2789
Location: NYC,USA

PostPosted: Wed May 19, 2021 2:23 am
Reply with quote

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
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1201

PostPosted: Wed May 19, 2021 5:26 am
Reply with quote

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
View user's profile Send private message
Venkat94

New User


Joined: 19 May 2021
Posts: 2
Location: India

PostPosted: Wed May 19, 2021 8:08 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2789
Location: NYC,USA

PostPosted: Wed May 19, 2021 11:51 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10801
Location: italy

PostPosted: Wed May 19, 2021 2:39 pm
Reply with quote

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
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Dynamic Sortin DD cards SYNCSORT 8
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
No new posts Extract 2 more lines below line that ... DFSORT/ICETOOL 2
No new posts Build two or more rows given some con... DFSORT/ICETOOL 9
Search our Forums:

Back to Top