View previous topic :: View next topic
|
Author |
Message |
srinivas.u
New User
Joined: 07 Jun 2004 Posts: 19
|
|
|
|
hi
in cobol file the record size is 70 i want retrive first 50 characters. |
|
Back to top |
|
|
imvs
New User
Joined: 12 May 2004 Posts: 33
|
|
|
|
srinivas.u,
In order to discuss in the same topic you can use POST REPLY instead of
opening a new topic.
Comming to you question, there are couple of ways to do it.
1) 01 ws-rec.
02 ws-reqd-50-data pic x(50).
02 filler pic x(20).
display ws-reqd-50-data.
2) 01 ws-rec pic x(70).
01 ws-reqd-50-data.
move ws-rec(1:50) to ws-reqd-50-data.
display ws-reqd-50-data. |
|
Back to top |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
Srinivas,
Actually you dont need to do any thing like above simply a move statement will solve this.
01 ws-rec-70 pic x(70).
01 ws-rec-50 pic x(50).
MOVE WS-REC-70 TO WS-REC-50.
This will retrieve only first 50 characters and rest will be truncated. |
|
Back to top |
|
|
muthukumarapandian
New User
Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
Hi imvs,
reference modifier is possible in cobo 85 and versions after that, simply moving 70 bytes variable to 50 bytes variable will truncate and gives the required result. |
|
Back to top |
|
|
ankyhunk
Moderator
Joined: 05 May 2005 Posts: 98 Location: Navi Mumbai, India
|
|
|
|
You can also copy a 70 char dataset to 50 char dataset using IEBGENER utility |
|
Back to top |
|
|
MainframeHelp4_u
New User
Joined: 15 Aug 2006 Posts: 25
|
|
|
|
1) Keep o/p file length 50 characters, and with SORTIN is 70 bytes file & SORTOUT is 50 bytes file.. try this option...
2) with the help ofSORT : Copy first/any 50 characters to output DSN..
Cheers
Mainframehelp4_u |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Or with REXX: "VAR1 = SUBSTR(VAR2,1,50)"
O. |
|
Back to top |
|
|
|