Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Suppressing empty values after XML-GENERATE statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
santhosh1234

New User


Joined: 26 Feb 2008
Posts: 2
Location: Pune

PostPosted: Fri Aug 28, 2009 11:34 am    Post subject: Suppressing empty values after XML-GENERATE statement
Reply with quote

Hello,

I am learning to use XML GENERATE in COBOL which works fine. Some of my elements in the structure for XML conversion have empty values after they are mapped to an input file. For example, the XML structure is

01 cardRecord.
05 addrLine1 PIC X(20).
05 addrLine2 PIC X(20).
05 name PIC X(30).
05 businessName PIC X(26).

Here,after mapping this to the i/p XML file, I have non-empty values in addrLine1,addrLine2,name whereas my businessName field has empty values.

Is there any way for me to prevent the tag having empty values not getting displayed after XML-GENERATE statement like this ?

<businessName> </businessName>

Please let me know if any more details are required.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Fri Aug 28, 2009 5:28 pm    Post subject:
Reply with quote

I just read the COBOL Language Reference manual (link at the top of the page) on XML GENERATE. Elementary variables are trimmed during processing but they are always left at one space. Hence, by what COBOL is doing, the variable is not empty -- it contains a space (which probably becomes the entire field of spaces).

Second, when the data is completely processed what do you think will be in the field -- there must be some value (LOW-VALUES, SPACES, ABC COMPANY, or whatever)? COBOL has no concept of an empty variable -- they always have some value (the variable might contain garbage, but it isn't empty because COBOL doesn't know empty). I think you need to consider what you want the variable to contain rather than attempting to do things the language makes impossible.
Back to top
View user's profile Send private message
santhosh1234

New User


Joined: 26 Feb 2008
Posts: 2
Location: Pune

PostPosted: Fri Aug 28, 2009 5:42 pm    Post subject:
Reply with quote

Hi Robert,

Thanks..I should have been careful while posting. Ideally the variable should contain character data after one to one mapping from input file; however if spaces are moved(the corresponding i/p field has spaces), then the XML GENERATE generates the tags with one space..as you have mentioned..I wanted to find out is there any way by giving an option along with the XML GENERATE statement to prevent such tags with no values (spaces) from being displayed.
Back to top
View user's profile Send private message
Sankar S

New User


Joined: 18 Sep 2014
Posts: 1
Location: INDIA

PostPosted: Wed Oct 08, 2014 4:38 pm    Post subject: Reply to: Suppressing empty values in tags after XML-GENERAT
Reply with quote

I too need to suppress some of the empty tags in my XML. Is there any way to do it ?
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Oct 10, 2014 1:13 am    Post subject:
Reply with quote

Not built in there isn't. (in before you get hollered at for tailgating an old thread)
Back to top
View user's profile Send private message
babruvahana

New User


Joined: 30 Mar 2008
Posts: 10
Location: hyderabad

PostPosted: Fri Oct 31, 2014 6:08 pm    Post subject:
Reply with quote

You need to write an exit program called by the parser program you need to generate the parserprogram with exit option and in this new program you need to check for fields in your XML TAGS (Key tags) if they are greater than spaces if it is then skip the occurences
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us