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
 

 

how to embed comma inbetween the fields of the record

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

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Tue Aug 21, 2007 4:12 pm    Post subject: how to embed comma inbetween the fields of the record
Reply with quote

Hi,
I have two types of record (with diff layouts) in a file.
lets consider
A : name phoneno address
B : address name phoneno

now i have to include a comma between the fields (i.e)
my output should be some thing like this

A : name ,phoneno ,address
B : address ,name ,phoneno
Back to top
View user's profile Send private message

chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Tue Aug 21, 2007 4:23 pm    Post subject: Reply to: how to embed comma inbetween the fields of the rec
Reply with quote

Hi,

Using String we can concatinate all the data-items and keywords

STRING NAME DELIMITED BY SIZE (or ' ')
',' DELIMITED BY SIZE
PHONENO DELIMITED BY SIZE
',' DELIMITED BY SIZE
ADDRESS DELIMITED BY SIZE
INTO VARIABLE
END-STRING.

try this, this will help you.

Chiranjeevi
Back to top
View user's profile Send private message
Vinit Bhushan

New User


Joined: 17 Apr 2007
Posts: 4
Location: Gurgaon

PostPosted: Tue Aug 21, 2007 4:41 pm    Post subject:
Reply with quote

Hi,
You can also use this method.
To define the Extract along with the comma field.


Example
**********EXTRACT FILE LAYOUT START HERE*********
01 DTL-OUT-ICMPNMTC.
05 DTL-SSN PIC 9(09) VALUE ZEROES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-NM-LIN-1 PIC X(30) VALUE SPACES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-NXT-PMT-DAT PIC 9(08) VALUE ZEROES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-CUR-LN-BAL PIC 9(09).99 VALUE ZEROES.
**************************************************
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2007 3:32 am    Post subject:
Reply with quote

Hello,

Do you want the "whole" field copied to the output or only the meaningful characters?

Let's say name is 35 bytes long. Let's also say that the value is "SMITH, JOHN A.". What should the output look like?

Are commas permissable in the data fields or should embedded commas be removed?

Is this an interview question, school exercise, or an actual programming requirement? If this is a real requirement, you need to post more info on the rules for your input and output.
Back to top
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Wed Aug 22, 2007 6:48 am    Post subject:
Reply with quote

Thank u for all ur replies.

This is for real requirement and whole field has to be copied to the output (including the trailing spaces).
Comma must be a seperate character apart from the field.
Quote:
Let's say name is 35 bytes long. Let's also say that the value is "SMITH, JOHN A.". What should the output look like?


for this the comma should come at 36th position.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2007 7:11 am    Post subject:
Reply with quote

Hello,

I believe if that is the complete requirement, you could either use STRING or you could define a new area that was field-name1, comma-literal, field-name2, etc, as were suggested.

They should both yield the same result.
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm


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