Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 252
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
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us