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
 

 

Problem in UNSTRING....

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

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:13 pm    Post subject: Problem in UNSTRING....
Reply with quote

HI,


05 WK-DTL-RPMT-DATE PIC X(10).

05 WK-IN-RPMT-DATE.
10 WK-IN-RPMT-CCYY PIC 9(04) VALUE ZEROS.
10 WK-IN-RPMT-MM PIC 9(02) VALUE ZEROS.
10 WK-IN-RPMT-DD PIC 9(02) VALUE ZEROS.

INPUT:
12/02/2004
05/5/2003

I used the following statement

UNSTRING WK-DTL-RPMT-DATE DELIMITED BY ALL "/"
INTO WK-IN-RPMT-MM, WK-IN-RPMT-DD, WK-IN-RPMT-CCYY
END-UNSTRING

RESULT:
WK-IN-RPMT-DATE:20041202
WK-IN-RPMT-DATE:00300505

But i want to get value for 05/5/2003 as 20030505

Any one please help me...I need urgently

Regards
R KARTHIK
Back to top
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed Jun 04, 2008 3:23 pm    Post subject:
Reply with quote

I think you should first verify your data.
How is your DD carrying only one character?
Back to top
View user's profile Send private message
yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Wed Jun 04, 2008 3:25 pm    Post subject: Re: Problem in UNSTRING....
Reply with quote

karthikr44 wrote:
HI,


05 WK-DTL-RPMT-DATE PIC X(10).

05 WK-IN-RPMT-DATE.
10 WK-IN-RPMT-CCYY PIC 9(04) VALUE ZEROS.
10 WK-IN-RPMT-MM PIC 9(02) VALUE ZEROS.
10 WK-IN-RPMT-DD PIC 9(02) VALUE ZEROS.

INPUT:
12/02/2004
05/5/2003


But i want to get value for 05/5/2003 as 20030505



As your input Value is 05/5/2003 not 05/05/2003 you are getting wrong output.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:28 pm    Post subject: Reply to: Problem in UNSTRING....
Reply with quote

Input file may contain both format as belows
12/02/2004
05/5/2003

And i read into 05 WK-DTL-RPMT-DATE PIC X(10).
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:34 pm    Post subject:
Reply with quote

Add this validation to the code after the unstring.

Code:

IF WK-IN-RPMT-MM(2:1) = SPACES                     
   MOVE WK-IN-RPMT-MM(1:1) TO WK-IN-RPMT-MM(2:1)   
   MOVE ZERO TO WK-IN-RPMT-MM(1:1)                 
END-IF                                             
IF WK-IN-RPMT-DD(2:1) = SPACES                     
   MOVE WK-IN-RPMT-DD(1:1) TO WK-IN-RPMT-DD(2:1)   
   MOVE ZERO TO WK-IN-RPMT-DD(1:1)                 
END-IF                                             
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:35 pm    Post subject:
Reply with quote

Forgot to mention. I declared the dates as alphanumeric.

Code:

01 WK-DTL-RPMT-DATE PIC X(10).   
01 WK-IN-RPMT-DATE.             
   05 WK-IN-RPMT-CCYY PIC X(04) .
   05 WK-IN-RPMT-MM   PIC X(02) .
   05 WK-IN-RPMT-DD   PIC X(02) .
Back to top
View user's profile Send private message
yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Wed Jun 04, 2008 3:38 pm    Post subject: Reply to: Problem in UNSTRING....
Reply with quote

You can use REFERNCE MODIFICATION to solve this problem.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:46 pm    Post subject: Reply to: Problem in UNSTRING....
Reply with quote

HI Manuneedhi K,

Currently the Date and Month are correct.

Only WK-IN-RPMT-CCYY is wronng.

But in ur code WK-IN-RPMT-MM , WK-IN-RPMT-DD are used.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed Jun 04, 2008 3:47 pm    Post subject:
Reply with quote

i think the similar validation is more useful, if done before the UNSTRING
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 3:52 pm    Post subject:
Reply with quote

Try with my code after declaring the dates as alphanumeric. It will work.

I have tested the code with your input data.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed Jun 04, 2008 3:57 pm    Post subject:
Reply with quote

Hi Manuneedhi K,
Definitely your code will work fine.
You are validating the data twice after the UNSTRING.
I think if you validate the data before the UNSTRING, it will save some coding as well as resource.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 4:05 pm    Post subject:
Reply with quote

Hi Gautam,

Can you clarify how coding this before the UNSTRING saves resource? If you are coding this before the UNSTRING you will again have to do the same ref mod to pad zeroes before the date and month, so i don't quite understand your point.

Thanks in advance.
Manu
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Jun 04, 2008 4:07 pm    Post subject: Reply to: Problem in UNSTRING....
Reply with quote

HI all,

05 WK-LIT-RPMT-CCYYS PIC 9(05) VALUE ZEROS.

Now i got the solution.

UNSTRING WK-DTL-RPMT-DATE DELIMITED BY "/"
INTO WK-IN-RPMT-MM, WK-IN-RPMT-DD, WK-LIT-RPMT-CCYYS
END-UNSTRING

IF WK-LIT-RPMT-CCYYS(1:1) = ZERO
MOVE WK-LIT-RPMT-CCYYS(2:4) TO WK-IN-RPMT-CCYY
ELSE
MOVE WK-LIT-RPMT-CCYYS(1:4) TO WK-IN-RPMT-CCYY
END-IF


Since i want the RPMT date to numeric, I dont used Manunidhi code. But
i will arrrive at this code only by his sample code. Thanks
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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm


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