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

Can you write 2 recs on SORTOUT when SORTIN has only 1 rec


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

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Thu Feb 23, 2017 12:07 am
Reply with quote

I am trying to create a SYMNAMES file for a following step and it seems that this type of file needs a different line for each symbolic character.
I want my output to look like this. But I cannot figure out how to get the 2nd line written.
Is there anyone that could advise me? I have already been thru the DFSORT manual both online and paper form.

The SORTIN looks like this

Code:
****** ***************************** Top of Data ***********
=COLS> ----+----1----+----2----+----3----+----4----+----5---
000001        HOX                               A
000002                       


My SortCards look like this

Code:
//SYSIN     DD *
 SORT FIELDS=COPY
 INREC IFTHEN=(WHEN=(8,3,CH,EQ,C'3RD'),      <-- 1ST RCD
        OVERLAY=(1:C' JP1,''201''',11:33C' '),HIT=NEXT),
       IFTHEN=(WHEN=(8,3,CH,EQ,C'HOX'),
        OVERLAY=(1:C' JP1,''203''',11:33C' '),HIT=NEXT),
       IFTHEN=(WHEN=(42,1,CH,EQ,C'A'),       <-- 2ND RCD not writing
        OVERLAY=(1:C' JP2,''A''',11:33C' '),HIT=NEXT),
       IFTHEN=(WHEN=(42,1,CH,EQ,C'C'),
        OVERLAY=(1:C' JP2,''C''',11:33C' '))
 OUTFIL ENDREC=2


I want the output to look like this, but cant write the 2nd record:
Code:
****** ***************************** Top of Data *
000001  JP1,'203'
000002  JP2,'B'
****** **************************** Bottom of Data


Thank you for any help you can give.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Feb 23, 2017 12:26 am
Reply with quote

You might want to use the OUTFIL with the '/' operator to write multiple lines.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 23, 2017 1:18 am
Reply with quote

Don't try to call your symbols JP1 and JP2, as those are in-built symbols with special meaning (to allow for up to 10 values from a PARM statement to DFSORT).

The SYMNAMES data set must contain fixed-length records of 80 bytes.

To generate two outputs from one input, you need to do as Arun has suggested, and use the slash operator, which is only present in BUILD in OUTFIL.
Code:

BUILD=(1,80,/,81,80)


That would output two records, from one 160-byte record.

Since you have data on the current record you want to test, you could OVERLAY the first output at 81:, the second output at 161: (with 240:X to pad with blanks) and then BUILD with 81,80,/,161,80.
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Thu Feb 23, 2017 4:25 am
Reply with quote

Thanks, but I have been searching the IBM Knowledge Center for almost 4 hours now looking for similar examples to what you have explained. I am a DFSORT newbie. Can you please point me to somewhere , that can point me to somewhere else, where I can try to find something similar to what I am trying to do please?
Thank you for your help.
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Thu Feb 23, 2017 4:45 am
Reply with quote

I tried this, but the output file is only 40 bytes, not 80 and the 2nd line still wont write.
Code:
SORT FIELDS=COPY
OUTFIL FILES=1,BUILD=(1,40,/,41,40),ENDREC=1
INREC IFTHEN=(WHEN=(8,3,CH,EQ,C'3RD'),      <-- 1ST RCD
       BUILD=(1:C' SS1,''201''',11:33C' '),HIT=NEXT),
      IFTHEN=(WHEN=(8,3,CH,EQ,C'HOX'),
       BUILD=(1:C' SS1,''203''',11:33C' '),HIT=NEXT),
      IFTHEN=(WHEN=(42,1,CH,EQ,C'A'),       <-- 2ND RCD NOT WRITING
       OVERLAY=(1:C' SS2,''A''',11:33C' '),HIT=NEXT),
      IFTHEN=(WHEN=(42,1,CH,EQ,C'C'),
       OVERLAY=(1:C' SS2,''C''',11:33C' '))
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Feb 23, 2017 7:22 pm
Reply with quote

Bill Woodger wrote:
The SYMNAMES data set must contain fixed-length records of 80 bytes
Sysaron - I think you missed this line in Bill's post above. If you intend to create a SYMNAMES data set, you would have to follow the rules.

You are not modifying your second symbol value, so you do not need any 'HIT=NEXT's. You might want to do something like this.
Code:
//SYSIN    DD *                             
  OPTION COPY                               
  INREC IFTHEN=(WHEN=(8,3,CH,EQ,C'3RD'),     
        OVERLAY=(8:C'201')),                 
        IFTHEN=(WHEN=(8,3,CH,EQ,C'HOX'),     
        OVERLAY=(8:C'203'))                 
  OUTFIL BUILD=(C'SS1,''',08,3,C'''',80:X,/,
                C'SS2,''',42,1,C'''')       

SORTOUT:
Code:
SS1,'203'
SS2,'A' 
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Thu Feb 23, 2017 8:58 pm
Reply with quote

Thank You Arun Raj!! I Really Appreciate this Help icon_biggrin.gif
I knew the SYMNAMES needed to be 80 bytes, but I had No Clue how to accomplish that, based on the IBM manuals and examples that I was looking at. Everything I tried failed the test. Thank You Again So Much!
~Sysaron
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 Write line by line from two files DFSORT/ICETOOL 7
This topic is locked: you cannot edit posts or make replies. How To Write, Compile and Execute Cob... COBOL Programming 5
No new posts Compare two files with a key and writ... SYNCSORT 3
No new posts SORT deletes the SORTOUT file DFSORT/ICETOOL 8
No new posts Creating CSV file from Variable recs ... DFSORT/ICETOOL 11
Search our Forums:

Back to Top