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
 

 

Cobol to split the file into two values as below

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

New User


Joined: 19 Jul 2010
Posts: 4
Location: Chennai

PostPosted: Mon Jul 19, 2010 6:07 pm    Post subject: Cobol to split the file into two values as below
Reply with quote

I have a input file which contains the values as Reportname and emailid. The file format looks as below.

TS DRA DETAIL abc@gmo.com
RS PRO SOURCE xyz@bro.com
TEL STA PRACTICE dro@tell.com
OS PROCESS RECORD tell@gro.com

My requirement is to split the file into two values as below format

Code:

ReportName             Email Address
TS DRA DETAIL          abc@gmo.com
RS PRO SOURCE          xyz@bro.com
TEL STA PRACTICE       dro@tell.com
OS PROCESS RECORD      tell@gro.com
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Mon Jul 19, 2010 6:12 pm    Post subject:
Reply with quote

Personally, I don't see any difference between the two lists you posted.

However, since email addresses cannot contain a space, use FUNCTION REVERSE to reverse the data and find the first space after the first non-space character and that's where you want to split. After you've moved the data to two variables, use FUNCTION REVERSE on each to get back into normal order.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Jul 19, 2010 6:20 pm    Post subject:
Reply with quote

Digital Siva sort of wrote:
Code:
TS DRA DETAIL abc@gmo.com
RS PRO SOURCE xyz@bro.com
TEL STA PRACTICE dro@tell.com
OS PROCESS RECORD tell@gro.com

Code:
ReportName                               Email Address
TS DRA DETAIL          abc@gmo.com
RS PRO SOURCE                           xyz@bro.com
TEL STA PRACTICE                       dro@tell.com
OS PROCESS RECORD                 tell@gro.com

And if he had just previewed, it would actually look correct..... icon_rolleyes.gif
Back to top
View user's profile Send private message
Digital Siva

New User


Joined: 19 Jul 2010
Posts: 4
Location: Chennai

PostPosted: Mon Jul 19, 2010 6:21 pm    Post subject: Cobol unstring
Reply with quote

I have used below cobol code,its extracts email address correctly but i didnt get report name field. it shows null value

Code:
UNSTRING INP-MAIL DELIMITED BY "@" INTO TEMP1,TEMP3.     
MOVE FUNCTION REVERSE(TEMP1) TO TEMP4.                   
UNSTRING TEMP4 DELIMITED BY ALL " " INTO TEMP5,TEMP6.   
MOVE FUNCTION REVERSE(TEMP6) TO TEMP4.                   
STRING TEMP4,TWO-PARTS DELIMITED BY " " INTO WS-EMAIL-ID.
DISPLAY " EMAIL ADDRESS=" WS-EMAIL-ID.                   
MOVE WS-EMAIL-ID TO OUP-MAIL.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Jul 19, 2010 6:40 pm    Post subject:
Reply with quote

TEMP6 should have the reversed report name. What you posted does not show anything being done with TEMP6.

Please learn to use the Code button to display code -- I've edited your post to do this but you need to do it yourself in the future.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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