Formatting in PS using DFSORT utility

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
udhay
Member
Posts: 2
Joined: Fri Aug 29, 2008 5:58 pm

Formatting in PS using DFSORT utility

Post by udhay » Tue Sep 02, 2008 10:28 am

Hi, I have a PS file with VB as a record format and it looks like below:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
********************************* Top of Data ****************************
.?.&CUSTROOT...............................>LOANSEGM......................
.?...?CUSTROOT...................d..?BR02-T02PETER THOMAS 1900 STANFORD
.?...;LOANSEGM...................d?.;A1A1978 CHEV VAN .....
.?...?CUSTROOT......................?BR02-T01JAMES TAYLOR 5411 OCEAN DR.
.?...;LOANSEGM....................?.;H1HADDITION OF A FAMILY ROOM .....


This is basically an IMS unload file and I want to format it in a proper way like SEGMENT NAME (current position is 7), two spaces, then remaining VALID data starts from 38th position. All the in between data looks like various non-editable characters (ie. NULLs). I tried to MOVE spaces for the nulls using the DFSORT utility using the below command but I'm not able to format it correctly and even I tried some other commands also. Can anyone pl. let me know the solution for this?

//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(0040)
OUTREC FIELDS=(20,31,TRAN=ALTSEQ)
/*

Finally I want the output dataset like below:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
********************************* Top of Data ****************************
CUSTROOT LOANSEGM
CUSTROOT BR02-T02PETER THOMAS 1900 STANFORD
LOANSEGM A1A1978 CHEV VAN
CUSTROOT BR02-T01JAMES TAYLOR 5411 OCEAN DR.
LOANSEGM H1HADDITION OF A FAMILY ROOM
Udhay

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Sep 02, 2008 10:09 pm

It's not clear if you're counting the RDW in positions 1-4 when giving the starting positions. I suspect you're not, so you need to add 4 to each starting position. If you want to create output records with the segment name, 2 spaces and the remaining valid data (assuming you weren't counting the RDW in the starting positions), and replace nulls with blanks, you can use DFSORT statements like this:

Code: Select all

//S1    EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)    
//SYSIN    DD    *                                                 
  OPTION COPY                                                      
  ALTSEQ CODE=(0040)                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,11,8,2X,42)),                 
    IFTHEN=(WHEN=INIT,BUILD=(1,4,5,TRAN=ALTSEQ))      
/*
If you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use the new FINDREP function instead of ALTSEQ and TRAN=ALTSEQ like this:

Code: Select all

             
  OPTION COPY                                                      
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,11,8,2X,42)),                 
    IFTHEN=(WHEN=INIT,FINDREP=(IN=X'00',OUT=C' '))                 
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

udhay
Member
Posts: 2
Joined: Fri Aug 29, 2008 5:58 pm

Formatting in PS using DFSORT utility

Post by udhay » Fri Sep 05, 2008 4:45 pm

Thanks a lot Frank!!!
Udhay

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others