MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic Field to be appended in a File

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Problem Determination
View previous topic :: View next topic  
Author Message
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Thu Aug 28, 2008 9:41 am    Post subject: Dynamic Field to be appended in a File Reply with quote

Hi all,

I have a series of Fields that needs to be filled in and sent(FTP) to a system. That system will be loading this data in Oracle apps.

My problem is that they want each field to end with a delimiter (~).

For example, if these are the fields.

INDICATOR (3)
VENDOR_ID (7)
VENDOR_NAME (25)
VENDOR_ADD (50)

If the values are

VEN
V223
XXXXYYYY
23 AAAAAA

the output should be

VEN~V223~XXXXYYYY~23 AAAAAA

To make this simple, irrespective of the data length, we need to add the delimiter at the end of each data. So I cant use filler to have this delimiter defined in my Working Storage.

How can this be acheived? Pls advice

Thanks
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Aug 28, 2008 10:24 am    Post subject: Reply with quote

You can do this in a number of ways. The COBOL string verb can be used. If your data has no embedded spaces, just add a DELIMITED BY SPACE clause for each field. If there's any chance of embedded spaces, you need to code something to determine the actual length of the data in a field. If you're selecting VARCHAR fields from a DB2 table, you already have the length in the 49 level length field. You can also use REXX which is a little friendlier with string manipulations. I've also coded this type of routine using VBS on the Windows platform.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Aug 28, 2008 12:31 pm    Post subject: Reply with quote

arvibala,

Where are you getting the data from? Is it from a DB2 table ? If so there are many utilities which unload the data with delimiters.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Thu Aug 28, 2008 2:42 pm    Post subject: Reply with quote

No Kolusu,

I am getting this from 2 FLAT Files. I can use STRING verb, but it has some Numeric manupulation too before forming the Final Output file. I want something similar to STRING, but should work for both CHARACTER as well as NUMERIC.

Thanks
Arvind B
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Aug 29, 2008 2:27 am    Post subject: Reply with quote

as mentioned in the other board where you posted this question, move the numerics to numeric edited and then string that.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Fri Aug 29, 2008 11:08 am    Post subject: Reply with quote

Thanks Brenholtz,

But the problem is since Numeric Edited variable is Right aligned we will still get spaces.
Code:

INDICATOR (3)
VENDOR_ID (7)
VENDOR_NAME (25)
VENDOR_ADD (50)
NUMBER3-EDIT     PIC Z(10)

If the values are
Code:

VEN~
V223~
XXXXYYYY~
23 AAAAAA~
90

If we STRING these we will get
Code:

VEN~V223~XXXXYYYY~23 AAAAAA~       90

But I need
Code:

VEN~V223~XXXXYYYY~23 AAAAAA~90

_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 29, 2008 12:59 pm    Post subject: Reply with quote

arvibala,

Code:

INSPECT FUNCTION REVERSE(WS-NUMBER3-EDIT) 
TALLYING WS-TALLY FOR LEADING SPACE       
                                           
STRING WS-INDICATOR    DELIMITED BY size   
       WS-VENDOR-ID    DELIMITED BY size   
       WS-VENDOR-NAME  DELIMITED BY size   
       WS-VENDOR-ADD   DELIMITED BY SIZE   
       WS-NUMBER3-EDIT (WS-TALLY + 1 : )   
                       DELIMITED BY SIZE   
      INTO WS-FINAL-STRING                 
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Problem Determination All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group