IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Shift 4 digit code from 339th position of VB file to 23rd.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Sep 11, 2007 2:38 pm
Reply with quote

Hi,

I have a VB file with 404 lenght (while browsing its 400), now I want to shift the code '0002' present at 339 position of the file to 23rd position.

I was using SYNCSORT - OUTREC, but the jobs abending....the job I was trying was:

//SORT01 EXEC PGM=SYNCSORT
//SORTLIB DD DSN=SYS1.SORTLIB,DISP=SHR
//SORTIN DD DSN=DATASET.INPUT,DISP=SHR
//SORTOUT DD DSN=DATASET.OUTPUT,
// SPACE=(404,(1000,200),RLSE),
// DCB=(RECFM=VB,LRECL=404,DSORG=PS,BLKSIZE=0),
// DISP=(,CATLG,DELETE),UNIT=SYSDA
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,22,23:339,4,27:27,374)
/*
//*


I know the above job would not go in case of VB - Please could someone tell me the correct job - which I should try.

Would be really obliged, thanks.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Tue Sep 11, 2007 2:53 pm
Reply with quote

Do you intend to make the output four bytes longer?
Which?
Code:
from
xxxxxxxyyyyyyyzzzzzzz0002aaaaaa
to
xxxxxxxyyy0002yyyyzzzzzzzaaaaaa
or
xxxxxxxyyy0002zzzzzzz0002aaaaaa
or
xxxxxxxyyy0002yyyyzzzzzzz0002aaaaaa
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Sep 11, 2007 2:58 pm
Reply with quote

Thanks for replying, no would want to keep the same lengh i.e. -

from
xxxxxxxyyyyyyyzzzzzzz0002aaaaaa
to
xxxxxxxyyy0002yyyyzzzzzzzaaaaaa


So no increase in lenght.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Sep 11, 2007 3:05 pm
Reply with quote

Try with the below sort card, if you want to overwrite the 23,4(position and length in browse mode) with 339,4(position and length in browse mode)
Code:
SYSIN DD *
 OPTION COPY
 INREC OVERLAY=(27:343,4)
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Sep 11, 2007 3:09 pm
Reply with quote

Shankar,

Quote:
SYSIN DD *
OPTION COPY
INREC OVERLAY=(27:343,4)


Your control card just copies the data from 339 pos to 20 position, leaving the data @ 339 as it is. But the req is to copy the data as well as shifting the data.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Tue Sep 11, 2007 3:21 pm
Reply with quote

using the shortened example:
Code:
1234567890123456789012345678901234567890
llbbxxxxxxxyyyyyyyzzzzzzz0002aaaaaa
1234567890123456789012345678901234567890
llbbxxxxxxxyyy0002yyyyzzzzzzzaaaaaa

I think this would work:
1:1,14,15:26,4,19:15,11,30:30,6
you need to account for the three parts of the data, the removal of the 0002, the insertion of the 0002 and the shift of the data between the insertion and removal....
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Sep 11, 2007 3:51 pm
Reply with quote

murmohk1,
Thanks for notifying me.

shitij,
Try with the below sort card for your requirement.
Code:
//SYSIN DD *
 OPTION COPY
 INREC FIELDS=(001:001,004,
               005:005,022,
               027:343,004,
               031:027,317,
               348:348,057)
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Sep 11, 2007 7:33 pm
Reply with quote

Hi ,

the above one is not working, please could someone give an example of what I am looking for.


Please, thanks.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Sep 11, 2007 7:35 pm
Reply with quote

Please post the "not working" output.....
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Sep 11, 2007 9:15 pm
Reply with quote

The one I am now using is :

//SYSIN DD *
OPTION COPY
INREC OVERLAY=(27:343,4,343:C' ')
/*
//*



The thing is that the HDR and TRL shud be not undergo this overlay, may I know how can we do that?

HDR : 1797912007053120070907130258ALPS10705 EXTRACT FILE

Details Records :

501
501
501 i.e all detail records start with 501.

TRL : 9..Ï....ç.æ....<....hï......hï..
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Tue Sep 11, 2007 9:20 pm
Reply with quote

You'll need to add some IFTHEN logic.......
Back to top
View user's profile Send private message
prakash271082

New User


Joined: 09 Sep 2005
Posts: 53

PostPosted: Wed Sep 12, 2007 11:19 am
Reply with quote

Hi,

I think Shakar's code,

//SYSIN DD *
OPTION COPY
INREC FIELDS=(001:001,004,
005:005,022,
027:343,004,
031:027,317,
348:348,057)

should be working with one change in last line of control card. It should be,
343: 348,057 instead of 348:348,057.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Sep 12, 2007 12:08 pm
Reply with quote

shitij,

field1=001,022(position and length in browse mode)
field2=023,317(position and length in browse mode)
field3=339,004(position and length in browse mode)
field4=343,057(position and length in browse mode)
If you want to change [field1,field2,field3,field4] to [field1,field3,field2,field4] for all detail records which starts with '501', use the following sort card.
Code:
//SYSIN DD *
 OPTION COPY
 INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'501'),
              BUILD=(001:001,004,
                     005:005,022,
                     027:343,004,
                     031:027,317,
                     348:348,057))

If you want to override 23,4(position and length in browse mode) with 339,4(position and length in browse mode) for all detail records which starts with '501', use the following sort card
Code:
//SYSIN DD *
 OPTION COPY
 INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'501'),OVERLAY=(27:343,4))

prakash271082,
Hi,
Quote:

I think Shakar's code,

//SYSIN DD *
OPTION COPY
INREC FIELDS=(001:001,004,
005:005,022,
027:343,004,
031:027,317,
348:348,057)

should be working with one change in last line of control card. It should be,
343: 348,057 instead of 348:348,057.

I think it will work correct. Please let me know if i am wrong.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Sep 12, 2007 12:56 pm
Reply with quote

shitij,
Please use
Code:
 INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'501'),
instead of
Code:
 INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'501'),
in the before posted one for both two codes as it is a VB file.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top