|
View previous topic :: View next topic
|
| Author |
Message |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi Bill/Skolusu,
My input and output files are of FB, and LRELC=80. My input record contains certain report names. I need to attach a string to that report name and create an output file.
i/p data: data starts in position 3
| Code: |
Report started
BATCHSMF
BDR
BIND
CLRLINK
COBALL
Report ended
|
Expected O/P data:
| Code: |
PUT XXXX(BATCHSMF) BATCHSMF.TXT
PUT XXXX(BDR) BDR.TXT
PUT XXXX(BIND) BIND.TXT
PUT XXXX(CLRLINK) CLRLINK.TXT
PUT XXXX(COBALL) COBALL.TXT
|
I used the below code, but it is not properly working. Can someone please help?
| Code: |
INREC IFTHEN=(WHEN=(3,8,SS,EQ,C' '),
BUILD=(C'PUT ',C'''XXXX(',3,8,SQZ=(SHIFT=LEFT,
TRAIL=C')'''),C' ',3,8,SQZ=(SHIFT=LEFT,
TRAIL=C'.TXT'),80:X)),
IFTHEN=(WHEN=NONE,
BUILD=(C'PUT ',C'''XXXX(',3,8,C')''',C' ',
3,8,C'.TXT',80:X)) |
This is working when the string is of full 8 bytes, like incase of the name BATCHSMF. But others are not coming out properly.
Thanks for the help.
Regards
Amar |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
| Code: |
Code:
INREC IFTHEN=(WHEN=(3,8,SS,EQ,C' '),
BUILD=(C'PUT ',C'''XXXX(',3,8,SQZ=(SHIFT=LEFT,
TRAIL=C')'''),C' ',3,8,SQZ=(SHIFT=LEFT,
TRAIL=C'.TXT'),80:X)),
IFTHEN=(WHEN=NONE,
BUILD=(C'PUT ',C'''XXXX(',3,8,C')''',C' ',
3,8,C'.TXT',80:X))
|
Why are you checking from byte 3 for length 8 for 8 blanks? Do you not want to check byte 3 for length 2 equal to blanks? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Unless you want to pay me, don't ask for me. You are asking for everybody and anybody. See? Garry's stepped in, so don't go waiting, let us know. |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi Garry,
The name can be maximum of 8 bytes. So, I followed that approach to check for even a single byte with in 8 bytes starting from position 3. I think there is a mistake in the card or there can be a better approach.
Hi Bill,
I just thought to get solution from anyone. Normally you or Skolusu respond to DFSORT queries. So, I just referred the names there. Please ignore them.
Regards
Amar |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It is better to ask questions of the forum and then thank individuals when appropriate (rather than naming specific people with the question)
Is this now working? If not, post the current control statements and the actual output along with any dignostic info generated. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
V S Amarendra Reddy,
Please do NOT address your questions to individuals. Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
REPORT STARTED
BATCHSMF
BDR
BIND
CLRLINK
COBALL
REPORT ENDED
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,1,CH,EQ,C' ')
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,
BUILD=(C'PUT XXXX(',3,8,C')',
81:3,8,SQZ=(SHIFT=LEFT,TRAIL=C'.TXT',LENGTH=12))),
IFTHEN=(WHEN=INIT,
OVERLAY=(9:9,72,SQZ=(SHIFT=LEFT),
9:9,84,SQZ=(SHIFT=LEFT,MID=C' ')))
//* |
|
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi Skolusu,
Thanks a lot for your response. I wouldn't address to anybody in future.
Thank you once again.
Regards
Amar |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi Skolusu,
I have tested the code and it is working fine. Thank you for that. But I am not able to understand the logic you have applied here even though I know the functionality of each DFSORT parameters used here.
Could you please explain the logic behind the code?
Regards
Amar |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What you could do is comment the code and execute it again again and again by uncommenting them
By doing that, You could understand what happens in the code yourself and also there are manuals to assist on the syntax explanation |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you make a copy of the working JCL and sort control statements.
Then make a small change and watch what happens. Repeat until how the code works is clear.
The documentation does a good job explaining . . .  |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi,
I think I got it.
Regards
Amar |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|