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

Squeeze variable length data using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Jan 11, 2013 3:32 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jan 11, 2013 7:05 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jan 11, 2013 7:16 pm
Reply with quote

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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Jan 11, 2013 10:15 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 11, 2013 11:07 pm
Reply with quote

Hello,

It is better to ask questions of the forum and then thank individuals when appropriate (rather than naming specific people with the question) icon_wink.gif

Is this now working? If not, post the current control statements and the actual output along with any dignostic info generated.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Jan 12, 2013 3:08 am
Reply with quote

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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Sun Jan 13, 2013 7:13 pm
Reply with quote

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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Tue Jan 15, 2013 4:00 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jan 15, 2013 5:33 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 15, 2013 8:08 pm
Reply with quote

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 . . . icon_confused.gif
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Tue Jan 15, 2013 9:08 pm
Reply with quote

Hi,

I think I got it. icon_smile.gif

Regards
Amar
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top