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
Formatting in PS using DFSORT utility
Moderators: Frank Yaeger, Moderator Group
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
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:
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
//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))
/*
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page