| View previous topic :: View next topic |
| Author |
Message |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 17, 2009 11:38 am Post subject: Display logic code needed using SORT |
|
|
| I have an input file with 133 bytes and I want to use CHANGE logic and change data which starts from pos 54 in the input file from ABCDE to 'Have a a nice day' and change PQRST to 'Great job'. Can anybody tell me how I can do that.Input is FB and output should also be FB. |
|
| Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
|
Posted: Mon Aug 17, 2009 12:02 pm Post subject: |
|
|
yadav2005,
Use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABCDE
ABC
PQRST
EFG
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(54,5,CH,EQ,C'ABCDE'),
OVERLAY=(54:C'HAVE A NICE DAY')),
IFTHEN=(WHEN=(54,5,CH,EQ,C'PQRST'),OVERLAY=(54:C'GREAT JOB'))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
| Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 17, 2009 1:31 pm Post subject: |
|
|
Kolusu,
Thank you very much for the code. But I want to use CHANGE logic as I have already coded for huge changes. I want the data from 1 - 53 as it is , from 54 th pos data of 5 bytes change to 6 bytes , and from 60 position till 133 byte i want the data from the input file as it is. Can you please help further. |
|
| Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 17, 2009 2:11 pm Post subject: |
|
|
Kolusu,
Can you please help further , I am in need of help and it has become urgent for me. |
|
| Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
|
Posted: Mon Aug 17, 2009 2:15 pm Post subject: |
|
|
yadav2005,
How are you going to fit HAVE A NICE DAY in 6 bytes? And why cant you use OVERLAY? what is so special about CHANGE command? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
| Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 17, 2009 2:23 pm Post subject: |
|
|
Kolusu,
Initially I had coded Change logic for around 500 different cases and I was not able to run a good job and then I requested help .But since I have already coded so many lines , I am not able to proced ahead and hence wanted to seek help using change logic only else again it will taje a lot of time for me.
HAVE A NICE DAY is a sample which I am trying to mention. I want to change 5 bytes to 6 bytes only.
Sorry for all this. |
|
| Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
|
Posted: Mon Aug 17, 2009 2:44 pm Post subject: |
|
|
yadav2005,
If you change a 5 byte value to 6 bytes, you are increasing the length by a byte. But you say that want to keep the LRECL of the input and output same. Are you going to chop off the last byte? What will you pad with if you don't find a match? Remember when you seek help , make sure to provide all the details. I gave you a solution which is efficient and easy to understand but you decided to do in your own way. here is a sample using CHANGE command. note that you will have a space in position 59 for no match records
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,53,54,5,CHANGE=(6,C'ABCDE',C'VALUE1',
C'PQRST',C'VALUE2'),
NOMATCH=(54,5),
59,74)
/* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
| Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 17, 2009 2:51 pm Post subject: |
|
|
kolusu,
Thank You very much , it helped me a lot and I am able to complete by job with you help. |
|
| Back to top |
|
 |
|
|
|