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
 
Adding Quotes to Input Records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Wed Mar 05, 2008 11:02 pm    Post subject: Adding Quotes to Input Records
Reply with quote

Hi,

I have an input file with Account ID from 1st to 16th colomn. I want to add single quotes for each input record in 1st and 17th colomn.

Input file looks like below.

0000000000000001
0000000000000002
0000000000000003

Output should look like below:

'0000000000000001'
'0000000000000002'
'0000000000000003'

We have DFSORT. Can we achieve this using DFSORT?

Record length of my Input and output files 23 and Record Format is FB.

Regards,
KSK
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: Wed Mar 05, 2008 11:14 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'''',1,16,C'''',23:X)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Thu Mar 06, 2008 10:48 am    Post subject: Reply to: Adding Quotes to Input Records
Reply with quote

Hi Frank,

Thanks very much for your solution. It is working fine.

I have one more requirement here. I also want to add ,(comma) after last quote of each record.

i.e. output should look like below.

'0000000000000001',
'0000000000000002',
'0000000000000003'

Please note that last record should not have comma but all other prior records should have.

I tried with the following sort card but it is giving comma for last record also.

INREC BUILD=(C'''',1,16,C'''',C',',23:X)

And my actual output records are showing like below.

'0010089589511343',
'0010089589511343',
'0010089589562369',
'0010089589562469',

Last highlited comma should not come in my output.

Please let me know the solution.


Regards,
KSK
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 Mar 06, 2008 9:33 pm    Post subject:
Reply with quote

Here's a DFSORT job for your new requirement:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=('LASTRCD,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=23,
    IFTHEN=(WHEN=INIT,
      BUILD=(C'''',1,16,C''',',24:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(24,8,ZD,EQ,LASTRCD),
      OVERLAY=(19:X))
/*
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Tue Mar 18, 2008 11:46 am    Post subject:
Reply with quote

Thanks Frank. It worked fine.

Regards,
KSK
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

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