Page 1 of 1

Append a particular position of bytes from two files

PostPosted: Mon Dec 03, 2012 7:43 pm
by viki
Hi All,

Good evening.My requirement is to append a particular position of bytes from two files to be copied into third file.

Example:
File 1 lrecl: 80=> Out of that i want to copy extract from postion 10 to 50
File 2 lrecl: 10=> out of that i wan to extract from position 5 to 10

Output file:

File 3:lrecl 45=>10 to 50 bytes recs of file1 + 5 to 10 bytes of file2.

Please help me out.

Thanks,
viki.

Re: Append a particular position of bytes from two files

PostPosted: Mon Dec 03, 2012 8:05 pm
by enrico-sorichetti
what happened when You searched the DFSORT and/or the SYNCSORT sections with JOINKEYs ?

Re: Append a particular position of bytes from two files

PostPosted: Mon Dec 03, 2012 8:36 pm
by dick scherrer
Hello,

Which sort product is being used?

Do these files have a common key that can be used to JOIN?

Is there a guarantee there will be the same number of records in both files?

You need to post some sample data from both input files and the ouptut you want from this sample input - use the Code tag.

Your lengths are not as you say. . .

Re: Append a particular position of bytes from two files

PostPosted: Mon Dec 03, 2012 9:32 pm
by BillyBoyo
Looks like SyncSort from an earlier post. It is a simple JOINKEYS, if you have something to JOIN on, as Dick has already noted, so we await your response to his questions.

Re: Append a particular position of bytes from two files

PostPosted: Fri Dec 14, 2012 8:57 pm
by viki
Hi All,

sorry for the too delayed response.Actually i was trying with Join keys.But i didn't find the right way.

Actually my requirement is to change a set of position with some values.

Example:

File 1: AAAA.BBBB.CCCC-> contains 5 records

Name city Address State
1-----5 6----10 11----15 16-----20
ABCDE GDGDK 12ABC GFHDH
GGHGA DFDS 78SFF HSHFSF
FSFEE EFWEF EWABC SGSGER
YTYTY AAAAA BBBBB CCCCC
KKKKK LLLLL MMMMM FFFFF

I want to replace all the data in a position 6-10 and 16-20

Original Record(6-10) Needs to be changed in the position(6-10)
GDGDK AGFAF
DFDS DSFSF
EFWEF FFETE
AAAAA FSGWE
LLLLL WFGWE

same thing needs to be done for 16-20 position also.

Note: No values are unique.

Please share your ideas if you any.

Once again thanks to everyone who provided suggestion on this.I will be happy if i got anything.

Thanks,
viki.

Re: Append a particular position of bytes from two files

PostPosted: Fri Dec 14, 2012 9:02 pm
by viki
The final output should be like this.

Name city Address State
1-----5 6----10 11----15 16-----20
ABCDE AGFAF 12ABC AAAAA
GGHGA DSFSF 78SFF BBBBB
FSFEE FFETE EWABC VVVVV
YTYTY FSGWE BBBBB KKKKK
KKKKK WFGWE MMMMM ZZZZZ

Thanks,
viki.

Re: Append a particular position of bytes from two files

PostPosted: Fri Dec 14, 2012 9:07 pm
by enrico-sorichetti
if You are looking for <SORT> solution good manners dictate that You post to the appropriate forum
( YES, there is a forum for SYNCSORT and one for DFSORT )

find out what <SORT> product You are using DFSORT(ICE.... messages)/SYNCSORT(WER.... messages)
and post the result of

//S1 EXEC PGM=ICEMAN(SORT/SYNCSORT/whatever)
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*


so that we know the level of Your sort and the functions avilable

Re: Append a particular position of bytes from two files

PostPosted: Fri Dec 14, 2012 10:02 pm
by viki
i tried with SORT and SYNCSORT.I was getting WER message.

Thanks,
viki

Re: Append a particular position of bytes from two files

PostPosted: Fri Dec 14, 2012 11:43 pm
by dick scherrer
Hello,

You need to post the jcl and sort control statements you used along with the complete output with the diagnostic and informational messages.

Re: Append a particular position of bytes from two files

PostPosted: Sat Dec 15, 2012 4:49 am
by NicC
I have moved you to the Syncsort forum.
When you post the information requested by Dick please use the code tags. Th data you posted earlier is a load of ... as you did not use the code tags. Look at Enrico's post - he used the code tags. See how much easier it is to read his post than yours?