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

Want to copy only certain things from a file to another file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GANAPATH

New User


Joined: 06 Mar 2006
Posts: 35

PostPosted: Sat Apr 08, 2006 2:40 am
Reply with quote

Hi,

i have a file and i want to copy only certain things from that file to another file. The problem is, what i want to copy might not be in same position always, in such scenario how can i copy.

Ex: INPUTFILE

ABC FIRSTNAME = "KALYAN" LAST NAME ="VRIDHI CHANDIKA" 123,DOB="12-22-34"

OUTPUT FILE should look like this

kalyan,vridhi chandika,12-22-34

since the names are always of different length i cannot specify the position, now how can i copy this file and create my output, i don't want to write any programs for this, is there a simple way.

Appreciate it.
Thanks,
Ganapath
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Sat Apr 08, 2006 2:47 am
Reply with quote

the simple way is to write a program.
Back to top
View user's profile Send private message
GANAPATH

New User


Joined: 06 Mar 2006
Posts: 35

PostPosted: Sat Apr 08, 2006 2:51 am
Reply with quote

is there a way that we can use LASTNAME FIRST NAME fields to copy snd later i can add commas

Thanks,
Ganapth
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu May 04, 2006 3:07 am
Reply with quote

You can now do this using the new PARSE and SQZ functions available with z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) as shown in the DFSORT job below. What makes this tricky is that a string with blanks can be embedded in quotes for
input, but for output the string with blanks has to be kept as is with no quotes around it.

For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

Use [URL] BBCode for External Links

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  ALTSEQ CODE=(40FF,FF40)
* b represents blank and x represents FF.
  INREC IFTHEN=(WHEN=INIT,
* Get %00="VALUEb1", %01="VALUEb2", %02="VALUEb3"
    PARSE=(%00=(STARTAT=C'"',ENDAT=C'"',FIXLEN=12),
     %01=(STARTAT=C'"',ENDAT=C'"',FIXLEN=22),
     %02=(STARTAT=C'"',ENDAT=C'"',FIXLEN=10)),
* Build record with "valueb1"bbbb,"valueb2"bbbb,"valueb3"
    BUILD=(%00,TRAN=UTOL,C',',%01,TRAN=UTOL,C',',%02)),
* Squeeze out blanks outside of "s to get:
* "valueb1","valueb2","valueb3"b...b
   IFTHEN=(WHEN=INIT,BUILD=(1,46,SQZ=(SHIFT=LEFT,PAIR=QUOTE))),
* Replace blanks with FFs to get
* "valuex1","valuex2","valuex3"x...x
   IFTHEN=(WHEN=INIT,BUILD=(1,46,TRAN=ALTSEQ)),
* Remove "s and shift left to get
* valuex1,valuex2,valuex3x...xb...b
   IFTHEN=(WHEN=INIT,BUILD=(1,46,SQZ=(SHIFT=LEFT,PREBLANK=C'"'))),
* Replace FFs with blanks and blanks with FFs to get
* valueb1,valueb2,valueb3b...bx...x
   IFTHEN=(WHEN=INIT,BUILD=(1,46,TRAN=ALTSEQ)),
* Get %03=valueb1,valueb2,valueb3b...b
   IFTHEN=(WHEN=INIT,PARSE=(%03=(ENDBEFR=X'FF',FIXLEN=46)),
* Build final record with
* valueb1,valueb2,valueb3b...b
      BUILD=(%03))
/*
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 FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top