Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Want to copy only certain things from a file to another file
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: 247
Location: Cincinnati OH USA

PostPosted: Sat Apr 08, 2006 2:47 am    Post subject:
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    Post subject: Re: copy a file
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 Moderator


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

PostPosted: Thu May 04, 2006 3:07 am    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us